From 5baf1c67587942482667a837a0b11f415f8524da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Turan=20Yard=C4=B1mc=C4=B1?= <30504838+mturan33@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:00:42 +0300 Subject: [PATCH] fix(enjoy): restore --capture-video argument removed in #424 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cleanrl_utils/enjoy.py references args.capture_video at line 42 but the corresponding argparse definition was deleted during the tyro refactor (#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 #497 --- cleanrl_utils/enjoy.py | 2 ++ docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cleanrl_utils/enjoy.py b/cleanrl_utils/enjoy.py index afc869669..f71c7990b 100644 --- a/cleanrl_utils/enjoy.py +++ b/cleanrl_utils/enjoy.py @@ -20,6 +20,8 @@ def parse_args(): help="the id of the environment") parser.add_argument("--eval-episodes", type=int, default=10, help="the number of evaluation episodes") + parser.add_argument("--capture-video", action="store_true", + help="whether to capture videos of the agent performances (check out `videos` folder)") args = parser.parse_args() # fmt: on return args diff --git a/docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb b/docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb index 4cb022ec3..756f1d099 100644 --- a/docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb +++ b/docs/get-started/CleanRL_Huggingface_Integration_Demo.ipynb @@ -292,7 +292,7 @@ "source": [ "## Enjoy Utility\n", "\n", - "We have a simple way to load the model by running our \"enjoy\" utility, which automatically pull the model from 🤗 HuggingFace and run for a few episodes. It also produces a rendered video through the `--capture_video` flag. See more at our [📜 Documentation](https://docs.cleanrl.dev/get-started/zoo/)." + "We have a simple way to load the model by running our \"enjoy\" utility, which automatically pull the model from 🤗 HuggingFace and run for a few episodes. It also produces a rendered video through the `--capture-video` flag. See more at our [📜 Documentation](https://docs.cleanrl.dev/get-started/zoo/)." ] }, { @@ -338,7 +338,7 @@ } ], "source": [ - "!python -m cleanrl_utils.enjoy --exp-name dqn_atari_jax --env-id BreakoutNoFrameskip-v4 --eval-episodes 2 --capture_video" + "!python -m cleanrl_utils.enjoy --exp-name dqn_atari_jax --env-id BreakoutNoFrameskip-v4 --eval-episodes 2 --capture-video" ] }, {