Skip to content

added failure if users try to determine export method for direct rl e… - #7081

Open
frlai wants to merge 2 commits into
isaac-sim:developfrom
frlai:frlai/warn_direct_env_has_no_export_with
Open

added failure if users try to determine export method for direct rl e…#7081
frlai wants to merge 2 commits into
isaac-sim:developfrom
frlai:frlai/warn_direct_env_has_no_export_with

Conversation

@frlai

@frlai frlai commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Description

export_method is a argument for the export script that allows users to select the format (onnx, pt, etc.). This argument is only valid for managed environments. direct rl environments would ignore this silently. This new pr makes it fail loudly if someone supplies the export_method in cli while specifying a direct deployment environment.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@frlai
frlai requested a review from a team August 13, 2026 20:32

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

The direct-environment validation is implemented across all LEAPP exporters while preserving the manager-based default. Before merge, correct SB3’s misleading direct-environment error and either remove or document the newly accepted pt2 export method.

  • Design and architecture: The backend-specific validation is consistent, but SB3 is architecturally different because it does not support direct-environment export at all. Its existing unsupported-environment path should remain authoritative rather than suggesting a direct-export configuration.
  • API: Changing the parser default to None is compensated by an explicit onnx-dynamo fallback for manager-based environments. However, adding pt2 expands the public CLI choice set without corresponding help or changelog coverage and is outside the stated validation change.
  • Implementation: The rl_games, rsl_rl, and skrl paths now reject an explicitly supplied export method for direct environments as intended. In SB3, the new check masks the existing NotImplementedError and gives unusable advice because that backend cannot export direct environments.

Minor fixes needed. Posted 2 actionable findings inline.

Automated review; human maintainers own approval decisions.

try:
env = gym.make(args_cli.task, cfg=env_cfg, render_mode=None)
if not isinstance(env.unwrapped, ManagerBasedRLEnv):
if args_cli.export_method is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — SB3 direct-env error masks unsupported-environment message

SB3 LEAPP export does not support direct environments at all (the following NotImplementedError). Checking --export_method first replaces that accurate message with advice to "set export_with directly in the annotate.output_tensors() call", which cannot be followed here and implies direct export works for SB3. Raise the NotImplementedError first, or drop this extra check in the SB3 backend.

choices=["onnx-dynamo", "onnx-torchscript", "jit-script", "jit-trace"],
help="Method to export the policy",
default=None,
choices=["onnx-dynamo", "onnx-torchscript", "jit-script", "jit-trace", "pt2"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Suggestion · Api — Unrelated pt2 choice added without documentation

Adding "pt2" widens the accepted values of the public --export_method flag and is forwarded verbatim to patch_env_for_export, but it is unrelated to this change's stated purpose and appears in neither the help text nor the changelog fragment. Either drop it from this change or document it in the help string and changelog alongside the supporting backend support.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes LEAPP export-method selection explicit while preserving onnx-dynamo as the default and rejecting --export_method for direct environments.

  • Changes the CLI default to None so scripts can distinguish an omitted option from an explicit selection.
  • Applies the existing onnx-dynamo default within all four manager-based exporters.
  • Adds a clear error for unsupported explicit export-method selection on direct environments.
  • Adds pt2 to the accepted export-method choices and documents the behavioral fix in a changelog fragment.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue established in the changed paths.

The four exporters consistently distinguish omitted export-method selection from explicit input, retain the prior manager-based default, and reject unsupported direct-environment input without disrupting the existing direct export path.

Important Files Changed

Filename Overview
scripts/reinforcement_learning/leapp/export_utils.py Changes the export-method sentinel default, documents the effective default, and adds pt2 as a CLI choice.
scripts/reinforcement_learning/leapp/rl_games/export.py Resolves the manager-based default explicitly and rejects explicit export methods for direct environments.
scripts/reinforcement_learning/leapp/rsl_rl/export.py Preserves manager-based export behavior while adding the direct-environment validation.
scripts/reinforcement_learning/leapp/sb3/export.py Adds the explicit-method validation before SB3's existing rejection of non-manager-based environments.
scripts/reinforcement_learning/leapp/skrl/export.py Applies the common default and validation behavior without changing direct multi-agent conversion.
source/isaaclab/changelog.d/frlai-warn-direct-env-export-method.rst Records the newly raised error for direct-environment exports.

Reviews (1): Last reviewed commit: "added failure if users try to determine ..." | Re-trigger Greptile

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant