運行出現錯誤:
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運行