deep-rl-class icon indicating copy to clipboard operation
deep-rl-class copied to clipboard

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

Open diegocp01 opened this issue 1 year ago • 0 comments

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

diegocp01 avatar Sep 19 '24 19:09 diegocp01