Skip to content

Commit

Permalink
Save ckpt after every epoch.
Browse files Browse the repository at this point in the history
  • Loading branch information
zmgong committed Jul 13, 2024
1 parent fe91901 commit f371325
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions scripts/train_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ def main_process(rank: int, world_size: int, args):
wandb.log(dict_for_wandb,
commit=True)

if args.save_ckpt:
last_ckpt_path = os.path.join(folder_path, f'last.pth')
torch.save(model.state_dict(), last_ckpt_path)
print(f'Last ckpt: {last_ckpt_path}')
if args.save_ckpt:
last_ckpt_path = os.path.join(folder_path, f'last.pth')
torch.save(model.state_dict(), last_ckpt_path)
print(f'Last ckpt: {last_ckpt_path}')


@hydra.main(config_path="../bioscanclip/config", config_name="global_config", version_base="1.1")
Expand Down
8 changes: 4 additions & 4 deletions scripts/train_cl_on_insect_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ def main_process(rank: int, world_size: int, args):
wandb.log(dict_for_wandb,
commit=True)

if args.save_ckpt:
last_ckpt_path = os.path.join(folder_path, f'last_device_{rank}.pth')
torch.save(model.state_dict(), last_ckpt_path)
print(f'Last ckpt: {last_ckpt_path}')
if args.save_ckpt:
last_ckpt_path = os.path.join(folder_path, f'last_device_{rank}.pth')
torch.save(model.state_dict(), last_ckpt_path)
print(f'Last ckpt: {last_ckpt_path}')



Expand Down

0 comments on commit f371325

Please sign in to comment.