Skip to content

Commit 90101ca

Browse files
committed
Fix the storage of all models while training
1 parent 747bfd0 commit 90101ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agents/attackers/conceptual_q_learning/conceptual_q_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def play_game(self, concept_observation, episode_num, testing=False):
492492
# Store the model every --eval_each episodes.
493493
# Use episode (training counter) and not test_episode (test counter)
494494
if episode % args.store_models_every == 0 and episode != 0:
495-
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}.pickle')
495+
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}-episodes-{episode}.pickle')
496496

497497
text = f'''Tested for {test_episode} episodes after {episode} training episode.
498498
Wins={test_wins},
@@ -552,8 +552,8 @@ def play_game(self, concept_observation, episode_num, testing=False):
552552
except KeyboardInterrupt:
553553
# Store the q-table
554554
if not args.testing:
555-
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}.pickle')
555+
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}-episodes-{episode}.pickle')
556556
finally:
557557
# Store the q-table
558558
if not args.testing:
559-
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}.pickle')
559+
agent.store_q_table(path.join(path.dirname(path.abspath(__file__)), "models/"), f'conceptual_q_agent.experiment{args.experiment_id}-episodes-{episode}.pickle')

0 commit comments

Comments
 (0)