salohiddin94 commited on
Commit
5010926
1 Parent(s): 658a2fa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -2
README.md CHANGED
@@ -30,8 +30,26 @@ 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.common.vec_env import DummyVecEnv, VecNormalize
34
+
35
+ # Load the saved statistics
36
+ eval_env = DummyVecEnv([lambda: gym.make("PandaReachDense-v3")])
37
+ eval_env = VecNormalize.load("vec_normalize.pkl", eval_env)
38
+
39
+ # We need to override the render_mode
40
+ eval_env.render_mode = "rgb_array"
41
+
42
+ # do not update them at test time
43
+ eval_env.training = False
44
+ # reward normalization is not needed at test time
45
+ eval_env.norm_reward = False
46
+
47
+ # Load the agent
48
+ model = A2C.load("a2c-PandaReachDense-v3")
49
+
50
+ mean_reward, std_reward = evaluate_policy(model, eval_env)
51
+
52
+ print(f"Mean reward = {mean_reward:.2f} +/- {std_reward:.2f}")
53
 
54
  ...
55
  ```