stable-diffusion-for-fun/utilities/memory.py

11 lines
170 B
Python

import gc
import torch
def empty_memory():
'''
Performs garbage collection and empty cache in cuda device
'''
gc.collect()
torch.cuda.empty_cache()