Skip to content

Adds support for validating replay success using the task’s termination success. - #4170

Merged
kellyguo11 merged 4 commits into
isaac-sim:mainfrom
yami007007:replay_with_SR
Dec 17, 2025
Merged

kellyguo11 merged 4 commits into
isaac-sim:mainfrom
yami007007:replay_with_SR

Conversation

@yami007007

@yami007007 yami007007 commented Dec 8, 2025 •

Copy link
Copy Markdown
Contributor

Description

Add support for validating replay success using the task’s termination criteria in scripts/tools/replay_demos.py.

Type of change

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

Modifications

Only "scripts/tools/replay_demos.py" is modified.

Verification

  1. Download the pre-recorded dataset.hdf5 for the Isaac-Stack-Cube-Franka-IK-Rel-v0 task from the link provided in the teleoperation-imitation-learning documentation. And place it in the dataset folder.
  2. Run the following command to verify the changes:
    python scripts/tools/replay_demos.py --task Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5 --validate_success_rate
  3. For testing, I also augmented the above HDF5 file to a new one with 50 demonstration trajectories. You can use it to test the multi-env success rate.
    python scripts/tools/replay_demos.py --task Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5 --validate_success_rate --num_envs 13
    No matter how many environments are enabled, the output should be:

Successfully replayed: 31/50
Failed demo IDs (19 total):
[0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 23, 34, 45, 46, 47, 48, 49]

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 updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Dec 8, 2025
@greptile-apps

greptile-apps Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds support for validating replay success rate using the task's termination criteria in the replay_demos.py script. The implementation follows the same pattern used in other scripts like record_demos.py and generation.py for extracting and using success_term.

Key Changes:

  • Added --validate_success_rate CLI argument
  • Extracts success termination function from environment config (same pattern as existing scripts)
  • Tracks successful/failed episode counts during replay
  • Reports success statistics and failed demo IDs at the end

Issues Found:

  • Critical: The --validate_success_rate flag is defined but never checked - the success validation code runs unconditionally regardless of whether the flag is passed
  • The success statistics are always printed at the end, even when validation wasn't requested
  • Trailing whitespace (tabs) on lines 164 and 243

Confidence Score: 2/5

  • This PR has a logical error where the new flag is never checked, causing unintended behavior changes for all users
  • The core feature implementation is correct and follows existing patterns, but the critical bug of not checking the --validate_success_rate flag means the PR will change behavior for all existing users of replay_demos.py, not just those who opt-in with the flag
  • scripts/tools/replay_demos.py - needs to actually check the --validate_success_rate flag before running validation logic

Important Files Changed

File Analysis

Filename Score Overview
scripts/tools/replay_demos.py 2/5 Adds --validate_success_rate flag and success validation logic, but the flag is never checked - validation runs unconditionally. Also has trailing whitespace issues.

Sequence Diagram

sequenceDiagram
    participant User
    participant replay_demos.py
    participant env_cfg
    participant Environment
    participant success_term
    
    User->>replay_demos.py: Run with --validate_success_rate
    replay_demos.py->>env_cfg: parse_env_cfg()
    replay_demos.py->>env_cfg: Extract success termination
    env_cfg-->>replay_demos.py: success_term
    replay_demos.py->>Environment: Create environment
    
    loop For each episode
        replay_demos.py->>Environment: Load episode & replay actions
        Environment-->>replay_demos.py: Episode complete
        replay_demos.py->>success_term: Check success_term.func(env)
        success_term-->>replay_demos.py: Success/Failure result
        replay_demos.py->>replay_demos.py: Update success/failure counters
    end
    
    replay_demos.py->>User: Print success rate & failed IDs
Loading

@greptile-apps greptile-apps 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.

Additional Comments (4)

  1. scripts/tools/replay_demos.py, line 154-163 (link)

    logic: The --validate_success_rate flag is defined but never used. The success validation code runs unconditionally. The success_term extraction and validation should be guarded by args_cli.validate_success_rate:

  2. scripts/tools/replay_demos.py, line 164 (link)

    style: Trailing tabs on this line (whitespace-only line with tabs)

  3. scripts/tools/replay_demos.py, line 243 (link)

    style: Trailing tabs on this line (whitespace-only line with tabs)

  4. scripts/tools/replay_demos.py, line 289-294 (link)

    logic: These success statistics will always be printed, even when --validate_success_rate is not specified. Should be conditional on the flag:

1 file reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@yami007007

Copy link
Copy Markdown
Contributor Author

@jtigue-bdai @Mayankm96 Could you help review this PR?Thanks.
cc @kellyguo11 for vis.

@kellyguo11
kellyguo11 requested a review from peterd-NV December 11, 2025 00:53

@peterd-NV peterd-NV left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fixes. The changes look good, I left a comment regarding one of the print statements as something that I think should be changed before merge.

Comment thread scripts/tools/replay_demos.py Outdated
f"Successfully replayed {recorded_episode_count} episode{plural_trailing_s} out"
f" of {replayed_episode_count} demos.",
" ",
current_episode_indices[env_id],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this print statement can be cleaned up a bit. Currently it's printing the episode index of the env_id without any explanation so it just shows up as a random integer. E.g. it looks something like:

Successfully replayed 2 episodes out of 5 demos. 1

I think we should either remove it (and the blank space before it), or add a more descriptive message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point. Clean the message. Could you help review it? Thanks.

@kellyguo11 kellyguo11 changed the title Add support for validating replay success using the task’s termination success. Adds support for validating replay success using the task’s termination success. Dec 12, 2025
@yami007007

yami007007 commented Dec 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Hi @peterd-NV, should I ask for feedback from other reviewers, or will this be merged directly later? Thanks.

@kellyguo11 kellyguo11 moved this to In review in Isaac Lab Dec 16, 2025
@kellyguo11
kellyguo11 merged commit bde0bca into isaac-sim:main Dec 17, 2025
@github-project-automation github-project-automation Bot moved this from In review to Done in Isaac Lab Dec 17, 2025
T-K-233 pushed a commit to ucb-bar/IsaacLab that referenced this pull request Dec 29, 2025
…on success. (isaac-sim#4170)

# Description

Add support for validating replay success using the task’s termination
criteria in scripts/tools/replay_demos.py.

## Type of change
- New feature (non-breaking change which adds functionality)


## Modifications
Only "scripts/tools/replay_demos.py" is modified.

## Verification
1. Download the pre-recorded dataset.hdf5 for the
Isaac-Stack-Cube-Franka-IK-Rel-v0 task from the
[link](https://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/5.1/Isaac/IsaacLab/Mimic/franka_stack_datasets/dataset.hdf5)
provided in the
[teleoperation-imitation-learning](https://isaac-sim.github.io/IsaacLab/main/source/overview/imitation-learning/teleop_imitation.html#teleoperation-imitation-learning)
documentation. And place it in the `dataset` folder.
2. Run the following command to verify the changes:
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate`
3. For testing, I also augmented the above HDF5 file to a new one with
50 demonstration
[trajectories](https://nvidia-my.sharepoint.com/:u:/p/weihuaz/IQAg9ke_LIefRonAMIZ7QyzfAeH_ydqwVbBGsPqwCSD0q3w?e=RqvPNw).
You can use it to test the multi-env success rate.
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate --num_envs 13`
No matter how many environments are enabled, the output should be:
> Successfully replayed: 31/50
> Failed demo IDs (19 total):
>   [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 23, 34, 45, 46, 47, 48, 49]

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Edify0991 pushed a commit to Edify0991/IsaacLab that referenced this pull request Jan 14, 2026
…on success. (isaac-sim#4170)

# Description

Add support for validating replay success using the task’s termination
criteria in scripts/tools/replay_demos.py.

## Type of change
- New feature (non-breaking change which adds functionality)


## Modifications
Only "scripts/tools/replay_demos.py" is modified.

## Verification
1. Download the pre-recorded dataset.hdf5 for the
Isaac-Stack-Cube-Franka-IK-Rel-v0 task from the
[link](https://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/5.1/Isaac/IsaacLab/Mimic/franka_stack_datasets/dataset.hdf5)
provided in the
[teleoperation-imitation-learning](https://isaac-sim.github.io/IsaacLab/main/source/overview/imitation-learning/teleop_imitation.html#teleoperation-imitation-learning)
documentation. And place it in the `dataset` folder.
2. Run the following command to verify the changes:
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate`
3. For testing, I also augmented the above HDF5 file to a new one with
50 demonstration
[trajectories](https://nvidia-my.sharepoint.com/:u:/p/weihuaz/IQAg9ke_LIefRonAMIZ7QyzfAeH_ydqwVbBGsPqwCSD0q3w?e=RqvPNw).
You can use it to test the multi-env success rate.
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate --num_envs 13`
No matter how many environments are enabled, the output should be:
> Successfully replayed: 31/50
> Failed demo IDs (19 total):
>   [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 23, 34, 45, 46, 47, 48, 49]

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
nitesh-subedi pushed a commit to nitesh-subedi/IsaacLab that referenced this pull request Feb 5, 2026
…on success. (isaac-sim#4170)

# Description

Add support for validating replay success using the task’s termination
criteria in scripts/tools/replay_demos.py.

## Type of change
- New feature (non-breaking change which adds functionality)


## Modifications
Only "scripts/tools/replay_demos.py" is modified.

## Verification
1. Download the pre-recorded dataset.hdf5 for the
Isaac-Stack-Cube-Franka-IK-Rel-v0 task from the
[link](https://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/5.1/Isaac/IsaacLab/Mimic/franka_stack_datasets/dataset.hdf5)
provided in the
[teleoperation-imitation-learning](https://isaac-sim.github.io/IsaacLab/main/source/overview/imitation-learning/teleop_imitation.html#teleoperation-imitation-learning)
documentation. And place it in the `dataset` folder.
2. Run the following command to verify the changes:
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate`
3. For testing, I also augmented the above HDF5 file to a new one with
50 demonstration
[trajectories](https://nvidia-my.sharepoint.com/:u:/p/weihuaz/IQAg9ke_LIefRonAMIZ7QyzfAeH_ydqwVbBGsPqwCSD0q3w?e=RqvPNw).
You can use it to test the multi-env success rate.
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate --num_envs 13`
No matter how many environments are enabled, the output should be:
> Successfully replayed: 31/50
> Failed demo IDs (19 total):
>   [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 23, 34, 45, 46, 47, 48, 49]

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
csj-275 pushed a commit to csj-275/IsaacLab that referenced this pull request Jul 8, 2026
…on success. (isaac-sim#4170)

# Description

Add support for validating replay success using the task’s termination
criteria in scripts/tools/replay_demos.py.

## Type of change
- New feature (non-breaking change which adds functionality)


## Modifications
Only "scripts/tools/replay_demos.py" is modified.

## Verification
1. Download the pre-recorded dataset.hdf5 for the
Isaac-Stack-Cube-Franka-IK-Rel-v0 task from the
[link](https://omniverse-content-production.s3-us-west-2.amazonaws.com/Assets/Isaac/5.1/Isaac/IsaacLab/Mimic/franka_stack_datasets/dataset.hdf5)
provided in the
[teleoperation-imitation-learning](https://isaac-sim.github.io/IsaacLab/main/source/overview/imitation-learning/teleop_imitation.html#teleoperation-imitation-learning)
documentation. And place it in the `dataset` folder.
2. Run the following command to verify the changes:
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate`
3. For testing, I also augmented the above HDF5 file to a new one with
50 demonstration
[trajectories](https://nvidia-my.sharepoint.com/:u:/p/weihuaz/IQAg9ke_LIefRonAMIZ7QyzfAeH_ydqwVbBGsPqwCSD0q3w?e=RqvPNw).
You can use it to test the multi-env success rate.
`python scripts/tools/replay_demos.py --task
Isaac-Stack-Cube-Franka-IK-Rel-v0 --dataset_file ./dataset/dataset.hdf5
--validate_success_rate --num_envs 13`
No matter how many environments are enabled, the output should be:
> Successfully replayed: 31/50
> Failed demo IDs (19 total):
>   [0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 23, 34, 45, 46, 47, 48, 49]

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
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

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants