huggingface / huggingface/huggingface_sb3

I am getting the following error while publish the trained model on the Hub

Open
#46 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
97
Forks
28
Avg merge
25m
Merged PRs (30d)
1

Description

Description: While running the following code snipet :

from huggingface_sb3 import package_to_hub

package_to_hub(
model=model,
model_name=f"a2c-{env_id}",
model_architecture="A2C",
env_id=env_id,
eval_env=eval_env,
repo_id=f"dasayantan/a2c-{env_id}", # Change the username
commit_message="Initial commit",
)

I am getting this 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.
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning:
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/evaluation.py:67: UserWarning: Evaluation environment is not wrapped with a ``Monitor`` wrapper. This may result in reporting modified episode lengths and rewards, if other wrappers happen to modify these. Consider wrapping environment first with ``Monitor`` wrapper.
warnings.warn(
Saving video to /tmp/tmphw7u31gr/-step-0-to-step-1000.mp4
/usr/local/lib/python3.10/dist-packages/moviepy/config_defaults.py:1: DeprecationWarning: invalid escape sequence '\P'
"""
Moviepy - Building video /tmp/tmphw7u31gr/-step-0-to-step-1000.mp4.
Moviepy - Writing video /tmp/tmphw7u31gr/-step-0-to-step-1000.mp4

Moviepy - Done !
Moviepy - video ready /tmp/tmphw7u31gr/-step-0-to-step-1000.mp4
✘ 'DummyVecEnv' object has no attribute 'video_recorder'
✘ 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
ℹ Pushing repo dasayantan/a2c-PandaReachDense-v3 to the Hugging Face
Hub
policy.optimizer.pth: 100%
 48.5k/48.5k [00:00<00:00, 89.9kB/s]
policy.pth: 100%
 46.4k/46.4k [00:00<00:00, 94.5kB/s]
pytorch_variables.pth: 100%
 864/864 [00:00<00:00, 5.35kB/s]
Upload 5 LFS files: 100%
 5/5 [00:00<00:00,  1.55it/s]
a2c-PandaReachDense-v3.zip: 100%
 114k/114k [00:00<00:00, 97.2kB/s]
vec_normalize.pkl: 100%
 2.64k/2.64k [00:00<00:00, 17.8kB/s]
ℹ Your model is pushed to the Hub. You can view your model here:
https://huggingface.co/dasayantan/a2c-PandaReachDense-v3/tree/main/
CommitInfo(commit_url='https://huggingface.co/dasayantan/a2c-PandaReachDense-v3/commit/8ac0c95466b34ac57e320f5357c035e5f113923e', commit_message='Initial commit', commit_description='', oid='8ac0c95466b34ac57e320f5357c035e5f113923e', pr_url=None, repo_url=RepoUrl('https://huggingface.co/dasayantan/a2c-PandaReachDense-v3', endpoint='https://huggingface.co/', repo_type='model', repo_id='dasayantan/a2c-PandaReachDense-v3'), pr_revision=None, pr_num=None)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the package_to_hub entry point and trace the DummyVecEnv video-recorder path shown in the error. Re-run the provided A2C example to confirm the replay-generation failure while the Hub upload succeeds. Done means package_to_hub generates the replay without the video_recorder error and still pushes the model successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.