huggingface/deep-rl-class

[HANDS-ON BUG] unit3: while pushing to the hub: AssertionError: The render_mode must be 'rgb_array', not human

sifatron opened this issue · 2 comments

Describe the bug

Running into a bug when trying to push to the hub:

!python -m rl_zoo3.push_to_hub --algo dqn --env SpaceInvadersNoFrameskip-v4 --repo-name dqn-SpaceInvadersNoFrameskip-v4 -orga eseskay -f logs/

Saving model to: hub/dqn-SpaceInvadersNoFrameskip-v4/dqn-SpaceInvadersNoFrameskip-v4
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/push_to_hub.py", line 398, in
package_to_hub(
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/push_to_hub.py", line 247, in package_to_hub
_generate_replay(model, eval_env, video_length, is_deterministic, repo_local_path)
File "/usr/local/lib/python3.10/dist-packages/huggingface_sb3/push_to_hub.py", line 133, in _generate_replay
env = VecVideoRecorder(
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/vec_video_recorder.py", line 52, in init
assert self.env.render_mode == "rgb_array", f"The render_mode must be 'rgb_array', not {self.env.render_mode}"
AssertionError: The render_mode must be 'rgb_array', not human
Exception ignored in: <function VecVideoRecorder.del at 0x7d92f3cef7f0>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/vec_video_recorder.py", line 113, in del
self.close_video_recorder()
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/vec_video_recorder.py", line 103, in close_video_recorder
if self.recording:
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/base_vec_env.py", line 420, in getattr
return self.getattr_recursive(name)
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/base_vec_env.py", line 443, in getattr_recursive
attr = self.venv.getattr_recursive(name)
File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/vec_env/base_vec_env.py", line 445, in getattr_recursive
attr = getattr(self.venv, name)
AttributeError: 'DummyVecEnv' object has no attribute 'recording'

Material

unit3.ipynb - Colab.pdf

  • Did you use Google Colab? - yes

I solved it by removing @update/hf installing the following instead:
!pip install git+https://github.com/DLR-RM/rl-baselines3-zoo
unit3.ipynb - Colab-worked.pdf