Skip to content

Instantly share code, notes, and snippets.

@milyiyo
Created March 31, 2023 17:30
Show Gist options
  • Save milyiyo/bb2542ca5008c1ca206a5cef951deeb2 to your computer and use it in GitHub Desktop.
Save milyiyo/bb2542ca5008c1ca206a5cef951deeb2 to your computer and use it in GitHub Desktop.
Clean the RAM and GPU in a Colab
import gc
import torch
gc.collect()
with torch.no_grad():
torch.cuda.empty_cache()
!nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment