解決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
解決
作者:iClaire
來源鏈接:https://www.cnblogs.com/iclaire/p/12658730.html
未經允許不得轉載:>貴州網站建設公司 » 解決CUDA out of memory