huggingface / huggingface_sb3

Additional code for Stable-baselines3 to load and upload models from the Hub.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

package_to_hub error (must be real number, not NoneType)

leeygu opened this issue · comments

PLACE the package_to_hub function you've just filled here

package_to_hub(
model=model, # Our trained model
model_name="ppo-LunarLander-v2", # The name of our trained model
model_architecture=model_architecture, # The model architecture we used: in our case PPO
env_id=env_id, # Name of the environment
eval_env=eval_env, # Evaluation Environment
repo_id=repo_id, # id of the model repository from the Hugging Face Hub (repo_id = {organization}/{repo_name} for instance
commit_message=commit_message,
)

Running above produces following error

ℹ This function will save, evaluate, generate a video of your agent,
create a model card and push everything to the hub. It might take up to 1min.
This is a work in progress: if you encounter a bug, please open an issue.
Exception ignored in: <function VecVideoRecorder.del at 0x7f6804faf6d0>
Traceback (most recent call last):
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/stable_baselines3/common/vec_env/vec_video_recorder.py", line 113, in del
self.close_video_recorder()
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/stable_baselines3/common/vec_env/vec_video_recorder.py", line 104, in close_video_recorder
self.video_recorder.close()
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/gymnasium/wrappers/monitoring/video_recorder.py", line 161, in close
clip.write_videofile(self.path, logger=moviepy_logger)
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/decorator.py", line 232, in fun
for i, extra in enumerate(extras):
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/decorator.py", line 232, in fun
for i, extra in enumerate(extras):
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/decorator.py", line 232, in fun
for i, extra in enumerate(extras):
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_writer.py", line 213, in ffmpeg_write_video
with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
File "/home/autoware/anaconda3/envs/deep_reinforcement_learning/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_writer.py", line 88, in init
'-r', '%.02f' % fps,
TypeError: must be real number, not NoneType
Saving video to /tmp/tmp_3job8no/-step-0-to-step-1000.mp4
Moviepy - Building video /tmp/tmp_3job8no/-step-0-to-step-1000.mp4.
Moviepy - Writing video /tmp/tmp_3job8no/-step-0-to-step-1000.mp4

✘ must be real number, not NoneType
✘ We are unable to generate a replay of your agent, the package_to_hub
process continues
✘ Please open an issue at
https://github.com/huggingface/huggingface_sb3/issues

https://github.com/huggingface/huggingface_sb3/issues/new

Hey there 👋 , can you share your notebook so that I can try to replicate the issue. Thanks