Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. import torch
  2. import shutil
  3. def save_ckp(state, is_best, checkpoint_dir, best_model_dir):
  4. f_path = checkpoint_dir / 'checkpoint.pt'
  5. torch.save(state, f_path)
  6. if is_best:
  7. best_fpath = best_model_dir / 'best_model.pt'
  8. shutil.copyfile(f_path, best_fpath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement