fix(enjoy): restore --capture-video argument removed in #424#550
Open
mturan33 wants to merge 1 commit into
Open
fix(enjoy): restore --capture-video argument removed in #424#550mturan33 wants to merge 1 commit into
mturan33 wants to merge 1 commit into
Conversation
cleanrl_utils/enjoy.py references args.capture_video at line 42 but the corresponding argparse definition was deleted during the tyro refactor (vwxyzjn#424). This causes any python -m cleanrl_utils.enjoy ... invocation to crash with AttributeError after the HF Hub model download succeeds. This restores the --capture-video flag with the same pattern used by training scripts (action="store_true", default False). Also corrects --capture_video → --capture-video in docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb. argparse does not normalize underscores to hyphens, so the documented command in the notebook would have failed even after the Python fix. Closes vwxyzjn#497
|
@mturan33 is attempting to deploy a commit to the Costa Huang's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
cleanrl_utils/enjoy.pyreferencesargs.capture_videoat line 42 but the correspondingargparsedefinition was removed during the tyro refactor in #424 — despite the PR's name,enjoy.pywas never actually migrated to tyro and remained on rawargparse. As a result, anypython -m cleanrl_utils.enjoy ...invocation crashes withAttributeError: 'Namespace' object has no attribute 'capture_video'immediately after the HuggingFace Hub model download succeeds.This PR restores the
--capture-videoflag using the exact same pattern as the training scripts (cleanrl/ppo.py,cleanrl/ddpg_continuous_action.py,cleanrl/sac_continuous_action.py):action="store_true", defaultFalse, byte-identical help text.It also corrects
--capture_video→--capture-videoindocs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb(two occurrences).argparsedoes not normalize underscores to hyphens, so the documented command in the notebook would have failed even after the Python fix.Verification
Reproduced the original crash on
master: AttributeError: 'Namespace' object has no attribute 'capture_video'After the fix:
python -m cleanrl_utils.enjoy --env-id CartPole-v1 --exp-name dqn --eval-episodes 1→args.capture_video = Falsepython -m cleanrl_utils.enjoy --env-id CartPole-v1 --exp-name dqn --eval-episodes 1 --capture-video→args.capture_video = Truepython -m cleanrl_utils.enjoy --help→ now lists--capture-videowith the correct help textNote: I used
--exp-name dqnfor repro becauseppois not a registered key incleanrl_utils/evals/__init__.py. The argparse-level fix is exp-name-independent.Out of scope (worth flagging separately)
enjoy.pyis the lastcleanrl_utils/module still on rawargparse. A full tyro migration would be cleaner long-term but is intentionally not bundled here — mixing a refactor with a regression fix complicates review.tests/test_enjoy.pyexists but is not wired into any CI workflow and its commands are malformed (python enjoy.py --env ...instead ofpython -m cleanrl_utils.enjoy --env-id ...). This is why the regression went uncaught for ~15 months. Happy to open a separate issue for this.Closes #497
Types of changes
Checklist:
pre-commit run --all-filespasses (required).--capture-video(defaultFalsematches pre-Refactor to use tyro #424 behavior).