Skip to content

Commit

Permalink
Make checkpoint directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewGerber committed Nov 26, 2023
1 parent 186582b commit 3a8cc4b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rlai/gpi/monte_carlo/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def iterate_value_q_pi(

checkpoint_path_with_index = insert_index_into_path(checkpoint_path, i)
final_checkpoint_path = checkpoint_path_with_index
os.makedirs(os.path.dirname(final_checkpoint_path), exist_ok=True)
with open(checkpoint_path_with_index, 'wb') as checkpoint_file:
pickle.dump(resume_args, checkpoint_file)

Expand Down
1 change: 1 addition & 0 deletions src/rlai/gpi/temporal_difference/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def iterate_value_q_pi(

checkpoint_path_with_index = insert_index_into_path(checkpoint_path, i)
final_checkpoint_path = checkpoint_path_with_index
os.makedirs(os.path.dirname(final_checkpoint_path), exist_ok=True)
with open(checkpoint_path_with_index, 'wb') as checkpoint_file:
pickle.dump(resume_args, checkpoint_file)

Expand Down
1 change: 1 addition & 0 deletions src/rlai/policy_gradient/monte_carlo/reinforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def improve(

checkpoint_path_with_index = insert_index_into_path(checkpoint_path, episodes_finished)
final_checkpoint_path = checkpoint_path_with_index
os.makedirs(os.path.dirname(final_checkpoint_path), exist_ok=True)
with open(checkpoint_path_with_index, 'wb') as checkpoint_file:
pickle.dump(resume_args, checkpoint_file)

Expand Down

0 comments on commit 3a8cc4b

Please sign in to comment.