pytorch: garbage collection freeing up memory
This function will free up your memory if you're having some problems:
import gc def garbage_collect(model): del model gc.collect() torch.cuda.empty_cache()
This function will free up your memory if you're having some problems:
import gc def garbage_collect(model): del model gc.collect() torch.cuda.empty_cache()