Skip to content

Instantly share code, notes, and snippets.

@eminorhan
Last active January 13, 2022 16:40
Show Gist options
  • Save eminorhan/f66f92daa71e424d06f9fb050e364152 to your computer and use it in GitHub Desktop.
Save eminorhan/f66f92daa71e424d06f9fb050e364152 to your computer and use it in GitHub Desktop.
delete large memory checkpoint after loading in pytorch
checkpoint = torch.load(CHECKPOINT_PATH)
model.module.load_state_dict(checkpoint['model_state_dict'])
del checkpoint
torch.cuda.empty_cache()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment