Improved saving for single-agent

This commit is contained in:
Vasilis Valatsos 2023-11-25 17:20:43 +01:00
parent 4b3601eec9
commit f188db0c72
3 changed files with 9 additions and 3 deletions

View file

@ -61,16 +61,22 @@ for i in tqdm(range(n_episodes)):
if np.mean(avg_score) > np.mean(best_score): if np.mean(avg_score) > np.mean(best_score):
print( print(
f"\nNew Best score: {np.mean(avg_score)}\ f"\nNew Best score: {np.mean(avg_score)}\
\nOld Best score: {np.mean(best_score)}") \nOld Best score: {np.mean(best_score)}"
)
best_score = avg_score best_score = avg_score
print("Saving models for agent...") print("Saving models for agent...")
game.level.player_sprites[0].agent.save_models( agent.save_models(
actr_chkpt="player_actor", crtc_chkpt="player_critic") actr_chkpt="player_actor", crtc_chkpt="player_critic")
print("Models saved ...\n") print("Models saved ...\n")
else:
print(
f"Average score of round: {np.mean(avg_score)}\
\nBest score: {np.mean(best_score)}"
)
print("\nEpisodes done, saving models...") print("\nEpisodes done, saving models...")
game.level.player_sprites[0].agent.save_models( agent.save_models(
actr_chkpt="player_actor", crtc_chkpt="player_critic") actr_chkpt="player_actor", crtc_chkpt="player_critic")
print("Models saved ...\n") print("Models saved ...\n")

BIN
tmp/ppo/player_actor Normal file

Binary file not shown.

BIN
tmp/ppo/player_critic Normal file

Binary file not shown.