Update README.md
Browse files
README.md
CHANGED
@@ -29,22 +29,24 @@ using the [stable-baselines3 library](https://github.com/DLR-RM/stable-baselines
|
|
29 |
|
30 |
|
31 |
```python
|
|
|
32 |
import gymnasium as gym
|
33 |
|
34 |
from huggingface_sb3 import load_from_hub
|
35 |
|
36 |
from stable_baselines3 import PPO
|
37 |
-
from stable_baselines3.common.env_util import make_vec_env
|
38 |
from stable_baselines3.common.evaluation import evaluate_policy
|
39 |
from stable_baselines3.common.monitor import Monitor
|
40 |
|
41 |
repo_id = "AdanLee/ppo-LunarLander-v2"
|
42 |
filename = "ppo-LunarLander-v2.zip"
|
43 |
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
50 |
```
|
|
|
29 |
|
30 |
|
31 |
```python
|
32 |
+
# pip install shimmy
|
33 |
import gymnasium as gym
|
34 |
|
35 |
from huggingface_sb3 import load_from_hub
|
36 |
|
37 |
from stable_baselines3 import PPO
|
|
|
38 |
from stable_baselines3.common.evaluation import evaluate_policy
|
39 |
from stable_baselines3.common.monitor import Monitor
|
40 |
|
41 |
repo_id = "AdanLee/ppo-LunarLander-v2"
|
42 |
filename = "ppo-LunarLander-v2.zip"
|
43 |
|
44 |
+
custom_objects = {
|
45 |
+
"learning_rate": 0.0,
|
46 |
+
"lr_schedule": lambda _: 0.0,
|
47 |
+
"clip_range": lambda _: 0.0,
|
48 |
+
}
|
49 |
|
50 |
+
checkpoint = load_from_hub(repo_id, filename)
|
51 |
+
model = PPO.load(checkpoint, custom_objects=custom_objects, print_system_info=True)
|
|
|
52 |
```
|