Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HANDS-ON BUG] 'Publish our trained model on the Hub' error #564

Open
diegocp01 opened this issue Sep 19, 2024 · 0 comments
Open

[HANDS-ON BUG] 'Publish our trained model on the Hub' error #564

diegocp01 opened this issue Sep 19, 2024 · 0 comments

Comments

@diegocp01
Copy link

Describe the bug

when I try to 'Publish our trained model on the Hub' the error is the token is not 'write' but the token is write is logged in correctly

import gymnasium as gym

from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.env_util import make_vec_env

from huggingface_sb3 import package_to_hub

PLACE the variables you've just defined two cells above

Define the name of the environment

env_id = "LunarLander-v2"

TODO: Define the model architecture we used

model_architecture = "PPO"

Define a repo_id

repo_id is the id of the model repository from the Hugging Face Hub (repo_id = {organization}/{repo_name} for instance ThomasSimonini/ppo-LunarLander-v2

CHANGE WITH YOUR REPO ID

repo_id = "diegocp01/ppo-LunarLander-v2" # Change with your repo id, you can't push with mine 😄

Define the commit message

commit_message = "Upload PPO LunarLander-v2 trained agent"

Create the evaluation env and set the render_mode="rgb_array"

eval_env = DummyVecEnv([lambda: gym.make(env_id, render_mode="rgb_array")])

PLACE the package_to_hub function you've just filled here

package_to_hub(model=model, # Our trained model
model_name=model_name, # 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 ThomasSimonini/ppo-LunarLander-v2
commit_message=commit_message)

Material

  • Did you use Google Colab? Y

If not:

  • Your Operating system (OS) MacOS
  • Version of your OS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant