support cosmos3 nano policy and isaac env#1243
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for Cosmos3-Nano-Policy-DROID, including new configuration files, shell scripts, and model runner updates to handle policy observations, states, and action outputs. It also updates the ROS simulator nodes for Libero and RoboTwin to handle proper environment resets and provide a compatibility planner when Curobo is unavailable. The review feedback highlights a potential resource leak in cosmos3_runner.py where loaded .npz files are not explicitly closed, and advises against hardcoding absolute user paths in shared configuration files.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| elif suffix in (".npy", ".npz"): | ||
| payload = np.load(state_path, allow_pickle=True) | ||
| if isinstance(payload, np.lib.npyio.NpzFile): | ||
| payload = {key: payload[key] for key in payload.files} | ||
| elif isinstance(payload, np.ndarray) and payload.shape == () and isinstance(payload.item(), dict): | ||
| payload = payload.item() |
There was a problem hiding this comment.
When loading a .npz file, np.load returns an NpzFile object which should be closed to prevent resource leaks (such as running out of file descriptors in long-running services like ROS nodes). Overwriting payload directly prevents closing the file. We should load it into a temporary variable, extract the dictionary, and explicitly close the NpzFile object.
| elif suffix in (".npy", ".npz"): | |
| payload = np.load(state_path, allow_pickle=True) | |
| if isinstance(payload, np.lib.npyio.NpzFile): | |
| payload = {key: payload[key] for key in payload.files} | |
| elif isinstance(payload, np.ndarray) and payload.shape == () and isinstance(payload.item(), dict): | |
| payload = payload.item() | |
| elif suffix in (".npy", ".npz"): | |
| loaded = np.load(state_path, allow_pickle=True) | |
| if isinstance(loaded, np.lib.npyio.NpzFile): | |
| payload = {key: loaded[key] for key in loaded.files} | |
| loaded.close() | |
| elif isinstance(loaded, np.ndarray) and loaded.shape == () and isinstance(loaded.item(), dict): | |
| payload = loaded.item() | |
| else: | |
| payload = loaded |
| "adapter_model_path": "/data/nvme7/yongyang/fastwam_release/libero_uncond_2cam224.pt", | ||
| "dataset_stats_path": "/data/nvme7/yongyang/fastwam_release/libero_uncond_2cam224_dataset_stats.json", |
There was a problem hiding this comment.
Avoid hardcoding absolute paths pointing to a specific user's directory (e.g., /data/nvme7/yongyang/...) in shared configuration files. This makes the configuration non-portable and will cause failures on other machines or in production environments. Consider using relative paths or environment variables to resolve these paths dynamically.
No description provided.