Commit 3e7338b7 authored by lli's avatar lli
Browse files

update

parent 25c32d11
......@@ -139,7 +139,7 @@ for episode in range(n_episode):
f'num_no_capacity: {num_no_capacity[episode]}, accepted orders: {accepted_orders[episode]}')
print(f"Training time for {n_episode} episodes: {timer() - start_time}")
print(f"Training time for {args.n_episode} episodes: {timer() - start_time}")
# save the model parameters
torch.save(dqn.state_dict(), os.path.join(OUT_PATH, 'dqn_{}.pk1'.format(n_episode)))
......@@ -186,7 +186,7 @@ plt.savefig(os.path.join(OUT_PATH, 'penalties.png'), dpi=1200, transparent=True,
plt.close()
# Plot loss
loss= plt.plot(losses, label= 'Loss')
loss= plt.plot(sliding_window(losses, len(losses)), label= 'Loss')
plt.title('Loss')
plt.xlabel('Steps')
plt.ylabel('Loss')
......
......@@ -178,6 +178,8 @@ for episode in range(n_episode):
#writer.close()
print(f"Training time for {args.n_episode} episodes: {timer() - start_time}")
# save the model parameters
torch.save(policy_net.state_dict(), os.path.join(OUT_PATH, 'policy_{}.pk1'.format(n_episode)))
torch.save(value_net.state_dict(), os.path.join(OUT_PATH, 'value_{}.pk1'.format(n_episode)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment