TZ20 commited on
Commit
047307d
1 Parent(s): e9d060d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -2
README.md CHANGED
@@ -30,8 +30,22 @@ 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
+ repo_id = "TZ20/ppo-LunarLander-v2" # The repo_id
37
+ filename = "ppo-LunarLander-v2.zip" # The model filename.zip
38
+
39
+ # When the model was trained on Python 3.8 the pickle protocol is 5
40
+ # But Python 3.6, 3.7 use protocol 4
41
+ # In order to get compatibility we need to:
42
+ # 1. Install pickle5 (we done it at the beginning of the colab)
43
+ # 2. Create a custom empty object we pass as parameter to PPO.load()
44
+ custom_objects = {
45
+ "learning_rate": 0.0,
46
+ "lr_schedule": lambda _: 0.0,
47
+ "clip_range": lambda _: 0.0}
48
+
49
+ checkpoint = load_from_hub(repo_id, filename)
50
+ model = PPO.load(checkpoint, custom_objects=custom_objects, print_system_info=True)
51
  ```