BlackNoodle commited on
Commit
82fb51d
1 Parent(s): 438ea8c

Update README.md

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