Update README.md
Browse files
README.md
CHANGED
@@ -30,8 +30,12 @@ TODO: Add your code
|
|
30 |
|
31 |
|
32 |
```python
|
33 |
-
|
34 |
from huggingface_sb3 import load_from_hub
|
|
|
|
|
|
|
|
|
35 |
|
36 |
repo_id = "ChihoonLee3/ppomlppolicy-LunarLander-v2" # The repo_id
|
37 |
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
|
@@ -39,4 +43,9 @@ filename = "ppo-LunarLander-v2.zip" # The model filename.zip
|
|
39 |
# Load the PPO model
|
40 |
checkpoint = load_from_hub(repo_id, filename)
|
41 |
model = PPO.load(checkpoint, print_system_info=True)
|
|
|
|
|
|
|
|
|
|
|
42 |
```
|
|
|
30 |
|
31 |
|
32 |
```python
|
33 |
+
import gymnasium as gym
|
34 |
from huggingface_sb3 import load_from_hub
|
35 |
+
from stable_baselines3 import PPO
|
36 |
+
from stable_baselines3.common.monitor import Monitor
|
37 |
+
from stable_baselines3.common.evaluation import evaluate_policy
|
38 |
+
|
39 |
|
40 |
repo_id = "ChihoonLee3/ppomlppolicy-LunarLander-v2" # The repo_id
|
41 |
filename = "ppo-LunarLander-v2.zip" # The model filename.zip
|
|
|
43 |
# Load the PPO model
|
44 |
checkpoint = load_from_hub(repo_id, filename)
|
45 |
model = PPO.load(checkpoint, print_system_info=True)
|
46 |
+
|
47 |
+
# Evaluate the model in LunarLander-v2 environment
|
48 |
+
eval_env = Monitor(gym.make("LunarLander-v2"))
|
49 |
+
mean_reward, std_reward = evaluate_policy(model, eval_env, n_eval_episodes=10, deterministic=True)
|
50 |
+
print(f"mean_reward={mean_reward:.2f} +/- {std_reward}")
|
51 |
```
|