Skip to content

Commit bf6e592

Browse files
committed
add tensorboard logs
1 parent 23291dd commit bf6e592

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99
#env = gym.make('CartPole-v1')
1010
env = gym_torcs.TorcsEnv()
1111
policy_kwargs = dict(activation_fn=th.nn.ReLU,
12-
net_arch=[dict(pi=[128, 128], vf=[128, 128])])
12+
net_arch=[128, dict(pi=[64], vf=[256])])
1313

1414
if os.path.exists('a2c_torcs.zip'):
1515
print('Using saved model')
1616
model = A2C.load('a2c_torcs', env=env)
1717
else:
18-
model = A2C('MlpPolicy', env, policy_kwargs=policy_kwargs, verbose=1)
19-
model.learn(total_timesteps=1000, log_interval=5)
20-
print('Learning done')
18+
model = A2C('MlpPolicy', env, policy_kwargs=policy_kwargs, verbose=1, tensorboard_log="./tboard_logs/")
19+
20+
for i in range(10):
21+
print('Run {}: start'.format(i))
22+
model.learn(total_timesteps=1000, tb_log_name="run{}".format)
23+
print('Run {}: end'.format(i))
2124
model.save('a2c_torcs')
25+
print('Learning done')
2226
env.end()
2327
sys.exit()
2428
obs = env.reset()

0 commit comments

Comments
 (0)