解决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