解決CUDA out of memory


問題

用Pytorch跑模型時,會出現RuntimeError: CUDA out of memory

解決方法

1.真的沒有內存了

RuntimeError: CUDA out of memory. Tried to allocate 64.00 MiB 
(GPU 0; 4.00 GiB total capacity; 2.92 GiB already allocated; 58.76 MiB free; 
2.95 GiB reserved in total by PyTorch)

可以改小batch_size
2.內存足夠,不分配

RuntimeError: CUDA out of memory. 
Tried to allocate 784.00 MiB 
(GPU 0; 4.00 GiB total capacity; 456.81 MiB already allocated; 2.47 GiB free; 
548.00 MiB reserved in total by PyTorch)

Win10下多線程的問題,num_threads/workers=0解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM