DarkRodry commited on
Commit
01a7437
·
1 Parent(s): 0fe6787

update readme

Browse files
Files changed (1) hide show
  1. README.md +24 -2
README.md CHANGED
@@ -30,8 +30,30 @@ 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 stable_baselines3.common.env_util import make_vec_env
35
+ from stable_baselines3.common.evaluation import evaluate_policy
36
  from huggingface_sb3 import load_from_hub
37
 
38
+ # Download the model checkpoint
39
+ repo_id = "DarkRodry/ppo-LunarLander-v2"
40
+ filename = "base_tutorial_model.zip"
41
+ model_checkpoint = load_from_hub(repo_id, filename)
42
+
43
+
44
+ # Create a vectorized environment
45
+ env = make_vec_env("LunarLander-v2", n_envs=1)
46
+
47
+ # Load the model
48
+ model = PPO.load(model_checkpoint, env=env)
49
+
50
+ # Evaluate
51
+ print("Evaluating model")
52
+ mean_reward, std_reward = evaluate_policy(
53
+ model,
54
+ env,
55
+ n_eval_episodes=30,
56
+ deterministic=True,
57
+ )
58
+ print(f"Mean reward = {mean_reward:.2f} +/- {std_reward}")
59
  ```