Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import torch
- import shutil
- def save_ckp(state, is_best, checkpoint_dir, best_model_dir):
- f_path = checkpoint_dir / 'checkpoint.pt'
- torch.save(state, f_path)
- if is_best:
- best_fpath = best_model_dir / 'best_model.pt'
- shutil.copyfile(f_path, best_fpath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement