运行出现错误:
RuntimeError: CUDA out of memory. Tried to allocate 500.00 MiB (GPU 0; 4.00 GiB total capacity; 204.39 MiB already allocated; 363.42 MiB free; 373.61 MiB cached)
解决方法: 释放显存
torch.cuda.empty_cache()
如果还是解决不了:
(1)增加显存
(2)切换为CPU运行
运行出现错误:
RuntimeError: CUDA out of memory. Tried to allocate 500.00 MiB (GPU 0; 4.00 GiB total capacity; 204.39 MiB already allocated; 363.42 MiB free; 373.61 MiB cached)
解决方法: 释放显存
torch.cuda.empty_cache()
如果还是解决不了:
(1)增加显存
(2)切换为CPU运行