If you’re using torch, you can try torch.cuda.empty_cache(), and if that’s not enough, send your model to the CPU first, then empty the cache. But, if we’re being honest, I can’t ever quite get it to work the way I expect, and usually I end up restarting my kernel, as it’s the only way I know to reliably clear up GPU memory.