Views
No views yet
1import gymnasium as gym
2from stable_baselines3.common.vec_env import DummyVecEnv
3from stable_baselines3.common.env_util import make_vec_env
4
5from huggingface_sb3 import package_to_hub
6
7## TODO: Define a repo_id
8## 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
9repo_id =
10
11# TODO: Define the name of the environment
12env_id =
13
14# Create the evaluation env and set the render_mode="rgb_array"
15eval_env = DummyVecEnv([lambda: Monitor(gym.make(env_id, render_mode="rgb_array"))])
16
17
18# TODO: Define the model architecture we used
19model_architecture = ""
20
21## TODO: Define the commit message
22commit_message = ""
23
24# method save, evaluate, generate a model card and record a replay video of your agent before pushing the repo to the hub
25package_to_hub(model=model, # Our trained model
26 model_name=model_name, # The name of our trained model
27 model_architecture=model_architecture, # The model architecture we used: in our case PPO
28 env_id=env_id, # Name of the environment
29 eval_env=eval_env, # Evaluation Environment
30 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
31 commit_message=commit_message)
32
33...