Repository navigation
Conversation
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (1), Scope and over-engineering (1), Compatibility and deprecation (1), Implementation (1), Style consistency (3), Test quality (1). Other reviewed categories look good.
- PR description: Title and scope match; retain reported validation, remove test-edit narration, and benchmark per-observation camera processing with baseline/candidate revisions, command, hardware, backend, environment count, warmup, and latency.
- Design and architecture: Generic crop/resize processing violates the contribution guide’s utils.images ownership rule; move the transformation there and retain RLinf configuration translation in the adapter.
- Scope and over-engineering: Minimal implementation: Extend train_rlinf.py for context lifecycle, cli_args_rlinf.py for forwarding, play_rlinf.py for evaluation, and extension.py for worker adaptation; resolve split configuration once and move generic image processing to utils.images, eliminating per-observation dictionary merges. No source modules were added, and no parallel layer is required. Scope is cohesive; no split recommended.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: registering rlinf_runner_context adds a constructor keyword that existing task environments may reject; keep the hook outside Gym constructor kwargs or strip it before construction.
- Implementation: GR00T metadata uses training resize dimensions while evaluation images use split-specific dimensions, causing validation failures; derive metadata from the consuming split or reject incompatible dimensions.
- Style consistency: The camera helper omits its BHWC, dtype, and storage-aliasing contract; document these constraints so callers can distinguish borrowed storage from newly allocated output.
- Test quality: Camera and entrypoint cases protect distinct boundaries, but crossing padding with every device repeats adapter behavior already covered by transfer tests; retain one padded case.
Significant concerns. Posted 8 inline findings.
Automated review; human maintainers own approval decisions.
| rl_head_config=model_cfg.rl_head_config, | ||
| ) | ||
|
|
||
| if "gpu_resize_width" in cfg or "gpu_resize_height" in cfg: |
There was a problem hiding this comment.
🔴 Critical · Implementation — Match metadata to evaluation images
Model metadata uses training resize settings, while evaluation workers apply their own settings. Different dimensions fail GR00T video validation; derive metadata from the consuming split or reject incompatible split dimensions.
| runner.run() | ||
| spec = registry.get(task_id) | ||
| context = nullcontext() | ||
| if spec and (entry_point := spec.kwargs.get("rlinf_runner_context")): |
There was a problem hiding this comment.
🔴 Critical · Compatibility — Keep context out of constructor kwargs
Gym forwards specification kwargs to gym.make, so a registered rlinf_runner_context reaches task constructors that do not accept it. Store the hook separately or remove it before environment construction.
| logger.debug(f"REGISTER_ISAACLAB_ENVS now contains: {list(REGISTER_ISAACLAB_ENVS.keys())}") | ||
|
|
||
|
|
||
| def _prepare_camera_image(image: torch.Tensor, cfg: dict) -> torch.Tensor: |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Move image processing to utils.images
The contribution guide assigns image processing to utils.images. This generic crop/resize helper creates a second owner in the RLinf adapter; move the transformation there and keep configuration translation here.
|
|
||
|
|
||
| def _prepare_camera_image(image: torch.Tensor, cfg: dict) -> torch.Tensor: | ||
| """Crop a batch of RGB frames and resize to the policy input dimensions on the image device.""" |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Document camera tensor ownership
The helper requires BHWC input and can return the original tensor, a view, or a new tensor. Document shapes, dtype preservation, and aliasing so callers know whether the result owns storage.
| camera_obs = obs.get("camera_images", {}) | ||
|
|
||
| cfg = _get_isaaclab_cfg() | ||
| cfg = {**_get_isaaclab_cfg(), **self.cfg.get("isaaclab", {})} |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Resolve split settings once
Every observation allocates and merges the same configuration dictionary. Resolve fixed split settings during worker initialization and reuse them for observations and held-action padding.
|
|
||
|
|
||
| @pytest.mark.parametrize("explicit_success", [True, False], ids=["success-observation", "legacy-termination"]) | ||
| def test_episode_success_distinguishes_failure_and_timeout(explicit_success, set_config_env): |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Annotate the test return
This new test omits the required -> None return annotation used by neighboring tests. Add it.
| class TestObsConversion: | ||
| """Tests for ``_convert_isaaclab_obs_to_gr00t``.""" | ||
|
|
||
| def test_camera_crop_applies_when_resize_matches_input(self, set_config_env) -> None: |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Correct the test class description
The new tests exercise worker _wrap_obs, but the enclosing class says it tests _convert_isaaclab_obs_to_gr00t. Broaden the description or move these tests.
| "hold_pose,device,prefix_pad,suffix_pad", | ||
| [ | ||
| (False, "cpu", 0, 0), | ||
| *((True, device, prefix, suffix) for device in test_devices() for prefix, suffix in ((0, 0), (2, 1))), |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Avoid crossing padding with devices
Padding adds no device-specific adapter branch, while existing unpadded rows cover device transfers. Keep one padded row rather than repeating it on every device.
[Medium impact] The changes affect RLinf task setup and policy inputs across training and playback workflows. Fix conflicting preset overrides before merging; a CLI physics change can currently stop training or playback. FindingsSummaryThis PR lets simulator workers discover external tasks and adds explicit episode success, per-split camera settings, and a task-provided training context.
Reviews (1) · Last reviewed commit: "Support external RLinf tasks with split ..." · Reviewed by Greptile |
| configured = list(cfg.env[split].init_params.get("env_overrides") or ()) | ||
| cfg.env[split].init_params.env_overrides = configured + args_cli.env_overrides |
There was a problem hiding this comment.
If a recipe contains physics=physx and the user passes physics=newton_mjwarp, appending the lists sends both choices to resolve_task_config. _pick_alternative then raises ValueError because they select different alternatives for the same field. Training fails instead of using the CLI choice. Playback has the same problem.
Replace matching recipe selectors before appending CLI overrides.
| if "gpu_resize_width" in cfg or "gpu_resize_height" in cfg: | ||
| # GR00T validates incoming video against the recording metadata. The env worker has already resized RGB. | ||
| input_metadata = model.metadata.model_copy(deep=True) | ||
| for video in input_metadata.modalities.video.values(): | ||
| width, height = video.resolution | ||
| video.resolution = (cfg.get("gpu_resize_width", width), cfg.get("gpu_resize_height", height)) | ||
| modality_transform.set_metadata(input_metadata) |
There was a problem hiding this comment.
Metadata changes lack direct tests
No test calls the patched loader to exercise this metadata update. Existing tests only check whether the loader was replaced and separately check camera pixels. Swapped dimensions or changes to the wrong metadata object could pass all those tests.
Add a loader test with non-square resize dimensions. Check the metadata passed to set_metadata, verify the original metadata stays unchanged, and cover setting only one dimension.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Support installed external tasks in RLinf training and playback while keeping task and service implementations downstream. These shared changes are separate from #9148 and do not require its Trocar assets or task update.
isaaclab.utils.images, with worker split settings resolved once. Document dtype, layout and output storage ownership.Consumers: medical-pad GR00T/GRPO demo and Trocar Cosmos demo. Only the latter also requires the task changes in #9148.
Validation
isaaclab --formatchecks, including changelog validation, passed.GPU image-preprocessing measurement
Baseline:
7efebee54. Candidate:be4fa6814.NVIDIA A100 80 GB PCIe, PyTorch 2.11.0+cu130, GPU 0. Each observation processes 32 environments × 3 uint8 BHWC camera views, 320×240 → 224×224 with a 5% crop, bilinear antialiasing and extra-view stacking. Each case uses 50 warmups and 250 measured observations in interleaved baseline/candidate batches. Outputs match bit for bit for center and seeded random crops.
These are mean wall times per observation, synchronized at batch boundaries. A stand-in environment isolates the real
_wrap_obsimplementation; rendering, IPC and model inference are excluded. The small differences do not establish an end-to-end training speedup.Reproduce the preprocessing measurement
Run from the candidate checkout in an environment with Isaac Lab core dependencies installed. The baseline commit must be available locally. The stand-in supplies only the environment base; the benchmark extracts each revision's actual adapter methods.
Remaining review item
The
rlinf_runner_contextconstructor-keyword compatibility concern remains open for separate review; this update leaves that registration mechanism unchanged.Type of change