Update README.md
Browse files
README.md
CHANGED
@@ -26,12 +26,18 @@ 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 |
-
|
30 |
-
|
31 |
|
32 |
```python
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
...
|
37 |
```
|
|
|
26 |
using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
|
27 |
|
28 |
## Usage (with Stable-baselines3)
|
29 |
+
Follow to eval the agent locally:
|
|
|
30 |
|
31 |
```python
|
32 |
+
repo_id = "Laz4rz/hf-LunarLander-1-ppo" # The repo_id
|
33 |
+
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
|
34 |
+
|
35 |
+
checkpoint = load_from_hub(repo_id, filename)
|
36 |
+
model = PPO.load(checkpoint)
|
37 |
+
|
38 |
+
eval_env = Monitor(gym.make("LunarLander-v2"))
|
39 |
+
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
|
40 |
+
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
41 |
|
42 |
...
|
43 |
```
|