second commit
Browse files
README.md
CHANGED
|
@@ -20,33 +20,3 @@ model-index:
|
|
| 20 |
name: mean_reward
|
| 21 |
verified: false
|
| 22 |
---
|
| 23 |
-
|
| 24 |
-
# **PPO** Agent playing **LunarLander-v2**
|
| 25 |
-
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 |
-
First DL agent. Feel free to use for whatever lunar landings are required.
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
```python
|
| 33 |
-
# To load it and watch it land (on your computer NOT collab! You have to ditch render-mode="human" to run it in a notebook without visuals)
|
| 34 |
-
import gym
|
| 35 |
-
|
| 36 |
-
from huggingface_sb3 import load_from_hub
|
| 37 |
-
from stable_baselines3 import PPO
|
| 38 |
-
from stable_baselines3.common.evaluation import evaluate_policy
|
| 39 |
-
|
| 40 |
-
# Retrieve the model from the hub
|
| 41 |
-
## repo_id = id of the model repository from the Hugging Face Hub (repo_id = {organization}/{repo_name})
|
| 42 |
-
## filename = name of the model zip file from the repository
|
| 43 |
-
checkpoint = load_from_hub(repo_id="MattStammers/ppo-LunarLander-v2", filename="ppo-LunarLander-v2.zip")
|
| 44 |
-
model = PPO.load(checkpoint)
|
| 45 |
-
|
| 46 |
-
# Evaluate the agent and watch it land!
|
| 47 |
-
eval_env = gym.make('LunarLander-v2', render_mode="human")
|
| 48 |
-
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
|
| 49 |
-
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
| 50 |
-
|
| 51 |
-
...
|
| 52 |
-
```
|
|
|
|
| 20 |
name: mean_reward
|
| 21 |
verified: false
|
| 22 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|