-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patha2c_play.py
38 lines (24 loc) · 820 Bytes
/
a2c_play.py
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
31
32
33
34
35
36
37
38
import agents.a2c_continuous
from gym_linefollower.linefollower_env import LineFollowerEnvRawBasic as LineFollowerEnv
class LineFollowerEnvWrapper(LineFollowerEnv):
def __init__(self):
LineFollowerEnv.__init__(self)
def step(self, action):
observation, reward, done, info = super().step(action)
return observation, reward, [done, done], info
save_path = "./models/a2c/"
envs = []
env = LineFollowerEnvWrapper()
env.reset()
envs.append(env)
import models.a2c.src.model
import models.a2c.src.config
model = models.a2c.src.model
config = models.a2c.src.config.Config()
agent = agents.a2c_continuous.Agent(envs, model, config, save_path, save_stats=False)
agent.load()
agent.disable_training()
while True:
agent.main()
envs[0].render()
print("testing done")