清除cuda显存 2024-2-17 20:39 | 274 | 0 | NLP 227 字 | 3 分钟 今天在kaggle上跑模型的时候发现,模型还没开始跑就已经占用了11G的显存。这时候就需要清除一下系统中缓存的显存占用。 显存 我们先来查看一下系统显存占用情况: import torch def get_gpu_memory(): gpu_memory = torch.cuda.memory_allocated() / 1024 / 1024 /… huggingfacekaggleNLPtorch