Skip to content

Conversation

aliberts
Copy link
Collaborator

@aliberts aliberts commented Apr 30, 2024

Review filter

What this does

  • Add tests/scripts/save_policy_to_safetensor.py to generate test artifacts
  • Add test_backward_compatibility to test generated outputs from the policies against artifacts:
    • output_dict
    • grad_stats (actually mean and std for each of the policy module's gradient)
    • param_stats (actually mean and std for each of the policy's module)
    • actions

Note: Due to floating point precision errors, I had to restrict this test to only be run on an x86_64 kernel, which is what the test artifacts were generated on. This shouldn't be an issue as our CI runs on this platform.

Thanks to @alexander-soare and @Cadene for your precious help on that one!

How was it tested?

I've set rtol=0.1 and atol=1e-7 for the assert torch.isclose() through trial & error (see failed tests on commits below)

How to checkout & try? (for the reviewer)

git checkout main
git fetch origin
git checkout -b user/aliberts/2024_04_29_add_regression_tests --track origin/user/aliberts/2024_04_29_add_regression_tests

DATA_DIR=tests/data pytest -v tests/test_policies.py::test_backward_compatibility

@aliberts aliberts added the tests Problems with test coverage, failures, or improvements to testing label Apr 30, 2024
@aliberts aliberts self-assigned this Apr 30, 2024
@aliberts aliberts force-pushed the user/aliberts/2024_04_29_add_regression_tests branch 3 times, most recently from f22cf5a to 30a28d8 Compare May 2, 2024 13:33
@aliberts aliberts added the policies Items related to robot policies label May 2, 2024
@aliberts aliberts marked this pull request as ready for review May 2, 2024 14:16
@aliberts aliberts requested review from Cadene and alexander-soare May 2, 2024 14:16
Copy link
Contributor

@alexander-soare alexander-soare left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this @aliberts. Some comments, mostly minor.

@aliberts aliberts force-pushed the user/aliberts/2024_04_29_add_regression_tests branch from f74945f to 67f1b50 Compare May 2, 2024 16:52
@aliberts aliberts force-pushed the user/aliberts/2024_04_29_add_regression_tests branch from 4e0f121 to a5a1d18 Compare May 3, 2024 09:08
Copy link
Collaborator

@Cadene Cadene left a comment

Choose a reason for hiding this comment

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

YEASSSS PLEASE

@aliberts aliberts merged commit c77633c into main May 4, 2024
@aliberts aliberts deleted the user/aliberts/2024_04_29_add_regression_tests branch May 4, 2024 14:20
aliberts added a commit that referenced this pull request May 4, 2024
- Add `tests/scripts/save_policy_to_safetensor.py` to generate test artifacts
- Add `test_backward_compatibility to test generated outputs from the policies against artifacts
@aliberts aliberts mentioned this pull request May 9, 2024
menhguin pushed a commit to menhguin/lerobot that referenced this pull request Feb 9, 2025
- Add `tests/scripts/save_policy_to_safetensor.py` to generate test artifacts
- Add `test_backward_compatibility to test generated outputs from the policies against artifacts
Kalcy-U referenced this pull request in Kalcy-U/lerobot May 13, 2025
- Add `tests/scripts/save_policy_to_safetensor.py` to generate test artifacts
- Add `test_backward_compatibility to test generated outputs from the policies against artifacts
ZoreAnuj pushed a commit to luckyrobots/lerobot that referenced this pull request Jul 29, 2025
- Add `tests/scripts/save_policy_to_safetensor.py` to generate test artifacts
- Add `test_backward_compatibility to test generated outputs from the policies against artifacts
Ricci084 pushed a commit to JeffWang987/lerobot that referenced this pull request Sep 5, 2025
- Add `tests/scripts/save_policy_to_safetensor.py` to generate test artifacts
- Add `test_backward_compatibility to test generated outputs from the policies against artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
policies Items related to robot policies tests Problems with test coverage, failures, or improvements to testing
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants