Skip to content

Instantly share code, notes, and snippets.

@dsdanielpark
Last active March 27, 2023 14:02
Show Gist options
  • Save dsdanielpark/5d25fdfdfc9cd6cb7d388cfa1c087163 to your computer and use it in GitHub Desktop.
Save dsdanielpark/5d25fdfdfc9cd6cb7d388cfa1c087163 to your computer and use it in GitHub Desktop.
When you need to clean vram cache
import gc
gc.collect()

import torch
torch.cuda.empty_cache()

tf.keras.backend.clear_session()


from numba import cuda
device = cuda.get_current_device()
device.reset()

from numba import cuda 
device = cuda.get_current_device()
device.reset()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment