Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/source/experimental-features/rlinf_vla_posttraining.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,56 @@ Do not set this aarch64 path on x86_64 Linux. If it was inherited from a
previous setup, run ``unset LD_PRELOAD`` before launching Isaac Lab.


External task recipes and policy inputs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The CLI's ``--task`` overrides the task IDs in the recipe for both training and
validation workers. Without it, each split retains its own task ID. Simulator
subprocesses discover installed tasks through the ``isaaclab.tasks`` entry-point
group, so downstream tasks do not need to be copied into Isaac Lab.

Configure policy input size with ``gpu_resize_height`` and ``gpu_resize_width``
under each split's ``isaaclab`` section. Resizing stays on the image device and
rounds uint8 pixels to nearest; augmentation belongs to task observation
``tensor_processors``. GR00T N1.5 requires paired, matching train/eval dimensions,
validated before workers start.

For optional services around worker initialization and training, recipes may set:

.. code-block:: yaml

runner:
isaaclab_context: my_demo.training:service_context

The callable receives the runner and merged training environment overrides, and
returns a context manager whose cleanup also runs on exceptions. Service behavior
stays downstream; no context keywords are passed to Gym constructors.


Episode success metrics
~~~~~~~~~~~~~~~~~~~~~~~

Tasks with both success and failure terminations can configure a Boolean
observation under each split's ``isaaclab`` section:

.. code-block:: yaml

success_observation:
group: metrics
key: success

The adapter enables ``compute_final_obs`` and reads success from pre-reset
``info["final_obs"]``; policy observations still belong to the reset episode.
Both success metrics preserve the first completed episode's result through the
action chunk. Timeouts alone are not wins; missing terminal data raises an error.
Capturing terminal observations adds one observation computation on reset steps;
those observations are not retained in rollout infos. Without this setting,
existing recipes continue to count terminations as success.

Train/eval retain their own recipe ``init_params.env_overrides``. CLI overrides
replace matching recipe keys, including ``physics`` and ``renderer`` selectors.


Quick Start
-----------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Added device-preserving BHWC resizing with nearest rounding for uint8 pixels and an explicit output storage ownership contract.
Empty file.
29 changes: 29 additions & 0 deletions source/isaaclab/isaaclab/utils/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,35 @@ def is_normals_like(data_type: str) -> bool:
"""


def resize_images(
image: torch.Tensor,
height: int | None = None,
width: int | None = None,
) -> torch.Tensor:
"""Bilinearly resize a BHWC image batch on its existing device.

Args:
image: Four-dimensional ``(B, H, W, C)`` uint8 or floating-point images.
height: Output height, or None to retain the input height.
width: Output width, or None to retain the input width.

Returns:
Images with shape ``(B, height, width, C)``, preserving dtype and device.
Matching dimensions return the original tensor; resizing allocates new storage.
Integer pixels are rounded to nearest before conversion back to uint8.
Callers that mutate borrowed output must clone it first.
"""
size = (image.shape[1] if height is None else height, image.shape[2] if width is None else width)
if image.shape[1:3] == size:
return image
resized = torch.nn.functional.interpolate(
image.permute(0, 3, 1, 2).float(), size=size, mode="bilinear", align_corners=False, antialias=True
).permute(0, 2, 3, 1)
if image.dtype == torch.uint8:
resized = resized.round().clamp(0, 255)
return resized.to(image.dtype)


def normalize_rgb(
images: torch.Tensor,
channel_dim: int = -1,
Expand Down
17 changes: 17 additions & 0 deletions source/isaaclab/test/utils/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,20 @@ def test_single_batch_produces_channel_first_grid(self, device):
images = torch.ones((1, 2, 3, 3), device=device)
grid = make_camera_output_grid(images)
assert grid.shape == (3, 2, 3)


def test_resize_preserves_dtype_device_and_storage_ownership() -> None:
"""No-op resizing borrows input storage; resizing allocates and rounds integer pixels."""
image = torch.arange(16, dtype=torch.uint8).reshape(1, 4, 4, 1)
assert images_utils.resize_images(image) is image
resized = images_utils.resize_images(image, height=2, width=3)
assert resized.shape == (1, 2, 3, 1)
assert resized.dtype == image.dtype and resized.device == image.device
original = image.clone()
resized.zero_()
torch.testing.assert_close(image, original)

# Integer pixels round to nearest; floating images keep their fractional values.
pixels = torch.tensor([0, 3], dtype=torch.uint8).reshape(1, 1, 2, 1)
assert images_utils.resize_images(pixels, width=3).flatten().tolist() == [0, 2, 3]
assert images_utils.resize_images(pixels.float(), width=3).flatten().tolist() == [0, 1.5, 3]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fixed RLinf environment workers to register the selected Isaac Lab task and discover installed
external tasks in the simulator subprocess.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Added split-aware RLinf policy image resizing with matching GR00T metadata and driver-side validation.
* Added configurable terminal-success metrics that preserve completed-episode results across action chunks.
Empty file.
39 changes: 39 additions & 0 deletions source/isaaclab_contrib/isaaclab_contrib/rl/rlinf/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

"""RLinf recipe validation that does not import RLinf or load model weights."""

from collections.abc import Mapping


def validate_image_config(cfg: Mapping) -> None:
"""Reject invalid image sizes on the driver before worker extension errors can be caught by RLinf."""
env = cfg.get("env", {})
training = env.get("train", {}).get("isaaclab", {})
evaluation = {**training, **env.get("eval", {}).get("isaaclab", {})}
keys = ("gpu_resize_width", "gpu_resize_height")
for split, options in (("train", training), ("eval", evaluation)):
if any(key in options for key in ("gpu_crop_scale", "gpu_crop_random")):
raise ValueError(
f"env.{split}.isaaclab: configure crop augmentation in task observation tensor_processors, "
"not gpu_crop_scale/gpu_crop_random."
)
for key in keys:
value = options.get(key)
if value is not None and (isinstance(value, bool) or not isinstance(value, int) or value <= 0):
raise ValueError(f"env.{split}.isaaclab.{key} must be a positive integer, got {value!r}.")
model_type = cfg.get("actor", {}).get("model", {}).get("model_type", "gr00t")
if model_type == "gr00t_n1d7" or not training.get("data_config_class"):
return
for split, options in (("train", training), ("eval", evaluation)):
if (options.get(keys[0]) is None) != (options.get(keys[1]) is None):
raise ValueError(f"GR00T N1.5 requires both gpu_resize_width and gpu_resize_height in {split}.")
training_size = tuple(training.get(key) for key in keys)
evaluation_size = tuple(evaluation.get(key) for key in keys)
if training_size != evaluation_size:
raise ValueError(
"GR00T N1.5 requires matching train/eval image sizes after GPU resizing "
f"(width, height): train={training_size}, eval={evaluation_size}."
)
Loading