zhiweiyoung
commited on
Commit
•
3833072
1
Parent(s):
0062905
Update README.md
Browse files
README.md
CHANGED
@@ -19,6 +19,7 @@ model-index:
|
|
19 |
value: 240.43 +/- 20.04
|
20 |
name: mean_reward
|
21 |
verified: false
|
|
|
22 |
---
|
23 |
|
24 |
# **PPO** Agent playing **LunarLander-v2**
|
@@ -26,12 +27,22 @@ 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: Add your code
|
30 |
-
|
31 |
-
|
32 |
```python
|
33 |
-
from stable_baselines3 import ...
|
34 |
from huggingface_sb3 import load_from_hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
37 |
```
|
|
|
19 |
value: 240.43 +/- 20.04
|
20 |
name: mean_reward
|
21 |
verified: false
|
22 |
+
license: mit
|
23 |
---
|
24 |
|
25 |
# **PPO** Agent playing **LunarLander-v2**
|
|
|
27 |
using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines3).
|
28 |
|
29 |
## Usage (with Stable-baselines3)
|
|
|
|
|
|
|
30 |
```python
|
|
|
31 |
from huggingface_sb3 import load_from_hub
|
32 |
+
repo_id = "zhiweiyoung/ppo-LunarLander-v2" # The repo_id
|
33 |
+
filename = "zhiwei_ppo.zip" # The model filename.zip
|
34 |
+
|
35 |
+
# When the model was trained on Python 3.8 the pickle protocol is 5
|
36 |
+
# But Python 3.6, 3.7 use protocol 4
|
37 |
+
# In order to get compatibility we need to:
|
38 |
+
# 1. Install pickle5 (we done it at the beginning of the colab)
|
39 |
+
# 2. Create a custom empty object we pass as parameter to PPO.load()
|
40 |
+
custom_objects = {
|
41 |
+
"learning_rate": 0.0,
|
42 |
+
"lr_schedule": lambda _: 0.0,
|
43 |
+
"clip_range": lambda _: 0.0,
|
44 |
+
}
|
45 |
|
46 |
+
checkpoint = load_from_hub(repo_id, filename)
|
47 |
+
model = PPO.load(checkpoint, custom_objects=custom_objects, print_system_info=True)
|
48 |
```
|