-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStandupEval.py
More file actions
30 lines (25 loc) · 859 Bytes
/
StandupEval.py
File metadata and controls
30 lines (25 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import gym
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.evaluation import evaluate_policy
from stable_baselines3.common.env_util import make_vec_env
import concurrent.futures
LR = 2.55673e-05
epoch = 20
timestep = 1e7
bsize = 32
PPO_Path = os.path.join('Training','Saved Models', 'PPOHumanStand{}{}{}{}'.format(timestep,LR,bsize,epoch))
model= PPO.load(PPO_Path)
env = gym.make('HumanoidStandup-v2')
episodes = 10
for episode in range(1,episodes+1):
obs = env.reset()
done = False
score = 0
while not done:
env.render()
action, _ = model.predict(obs) # By doing this, rather than taking a random action, the model is used to take actions
obs, reward, done, info = env.step(action)
score += reward
env.close()