Updated model
Browse files- README.md +1 -45
- ppo-CartPole-v1.zip +2 -2
README.md
CHANGED
@@ -1,47 +1,3 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
- deep-reinforcement-learning
|
4 |
-
- reinforcement-learning
|
5 |
-
- stable-baselines3
|
6 |
---
|
7 |
-
|
8 |
-
This is a pre-trained model of a PPO agent playing CartPole-v1 using the [stable-baselines3](https://github.com/DLR-RM/stable-baselines3) library.
|
9 |
-
|
10 |
-
### Usage (with Stable-baselines3)
|
11 |
-
Using this model becomes easy when you have stable-baselines3 and huggingface_sb3 installed:
|
12 |
-
|
13 |
-
```
|
14 |
-
pip install stable-baselines3
|
15 |
-
pip install huggingface_sb3
|
16 |
-
```
|
17 |
-
|
18 |
-
Then, you can use the model like this:
|
19 |
-
|
20 |
-
```python
|
21 |
-
import gymnasium as gym
|
22 |
-
|
23 |
-
from huggingface_sb3 import load_from_hub
|
24 |
-
from stable_baselines3 import PPO
|
25 |
-
from stable_baselines3.common.evaluation import evaluate_policy
|
26 |
-
|
27 |
-
# Retrieve the model from the hub
|
28 |
-
## repo_id = id of the model repository from the Hugging Face Hub (repo_id = {organization}/{repo_name})
|
29 |
-
## filename = name of the model zip file from the repository
|
30 |
-
checkpoint = load_from_hub(
|
31 |
-
repo_id="sb3/demo-hf-CartPole-v1",
|
32 |
-
filename="ppo-CartPole-v1",
|
33 |
-
)
|
34 |
-
model = PPO.load(checkpoint)
|
35 |
-
|
36 |
-
# Evaluate the agent and watch it
|
37 |
-
eval_env = gym.make("CartPole-v1")
|
38 |
-
mean_reward, std_reward = evaluate_policy(
|
39 |
-
model, eval_env, render=True, n_eval_episodes=5, deterministic=True, warn=False
|
40 |
-
)
|
41 |
-
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
42 |
-
```
|
43 |
-
|
44 |
-
### Evaluation Results
|
45 |
-
Mean_reward: 500.0
|
46 |
-
|
47 |
-
|
|
|
1 |
---
|
2 |
+
{}
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ppo-CartPole-v1.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9f069009ac02df5da14a951605902c619a6c910a7ff1c2783785b3a7eb7dda9f
|
3 |
+
size 143103
|