Update README.md
Browse files
README.md
CHANGED
@@ -26,12 +26,41 @@ This is a trained model of a **PPO** agent playing **LunarLander-v2**
|
|
26 |
using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
|
27 |
|
28 |
## Usage (with Stable-baselines3)
|
29 |
-
TODO:
|
30 |
|
31 |
|
32 |
```python
|
33 |
-
|
34 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
...
|
37 |
```
|
|
|
26 |
using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
|
27 |
|
28 |
## Usage (with Stable-baselines3)
|
29 |
+
TODO: Diego's code
|
30 |
|
31 |
|
32 |
```python
|
33 |
+
import gymnasium as gym
|
34 |
+
from stable_baselines3.common.vec_env import DummyVecEnv
|
35 |
+
from stable_baselines3.common.env_util import make_vec_env
|
36 |
+
|
37 |
+
from huggingface_sb3 import package_to_hub
|
38 |
+
|
39 |
+
## TODO: Define a repo_id
|
40 |
+
## 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
|
41 |
+
repo_id =
|
42 |
+
|
43 |
+
# TODO: Define the name of the environment
|
44 |
+
env_id =
|
45 |
+
|
46 |
+
# Create the evaluation env and set the render_mode="rgb_array"
|
47 |
+
eval_env = DummyVecEnv([lambda: Monitor(gym.make(env_id, render_mode="rgb_array"))])
|
48 |
+
|
49 |
+
|
50 |
+
# TODO: Define the model architecture we used
|
51 |
+
model_architecture = ""
|
52 |
+
|
53 |
+
## TODO: Define the commit message
|
54 |
+
commit_message = ""
|
55 |
+
|
56 |
+
# method save, evaluate, generate a model card and record a replay video of your agent before pushing the repo to the hub
|
57 |
+
package_to_hub(model=model, # Our trained model
|
58 |
+
model_name=model_name, # The name of our trained model
|
59 |
+
model_architecture=model_architecture, # The model architecture we used: in our case PPO
|
60 |
+
env_id=env_id, # Name of the environment
|
61 |
+
eval_env=eval_env, # Evaluation Environment
|
62 |
+
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
|
63 |
+
commit_message=commit_message)
|
64 |
|
65 |
...
|
66 |
```
|