Minor model card update
Browse files
README.md
CHANGED
@@ -30,8 +30,24 @@ TODO: Add your code
|
|
30 |
|
31 |
|
32 |
```python
|
33 |
-
from stable_baselines3 import
|
34 |
from huggingface_sb3 import load_from_hub
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
```
|
|
|
30 |
|
31 |
|
32 |
```python
|
33 |
+
from stable_baselines3 import PPO
|
34 |
from huggingface_sb3 import load_from_hub
|
35 |
|
36 |
+
|
37 |
+
repo_id = "Classroom-workshop/assignment2-omar" # The repo_id
|
38 |
+
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
|
39 |
+
|
40 |
+
# When the model was trained on Python 3.8 the pickle protocol is 5
|
41 |
+
# But Python 3.6, 3.7 use protocol 4
|
42 |
+
# In order to get compatibility we need to:
|
43 |
+
# 1. Install pickle5 (we done it at the beginning of the colab)
|
44 |
+
# 2. Create a custom empty object we pass as parameter to PPO.load()
|
45 |
+
custom_objects = {
|
46 |
+
"learning_rate": 0.0,
|
47 |
+
"lr_schedule": lambda _: 0.0,
|
48 |
+
"clip_range": lambda _: 0.0,
|
49 |
+
}
|
50 |
+
|
51 |
+
checkpoint = load_from_hub(repo_id, filename)
|
52 |
+
model = PPO.load(checkpoint, custom_objects=custom_objects, print_system_info=True)
|
53 |
```
|