AdanLee commited on
Commit
11ecc8d
1 Parent(s): 3d4f746

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -6
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
- checkpoint = load_from_hub(repo_id, filename)
45
- model = PPO.load(checkpoint, print_system_info=True)
 
 
 
46
 
47
- eval_env = Monitor(gym.make("LunarLander-v2"))
48
- mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
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
  ```