Python报错:RuntimeError: CUDA out of memory. Tried to allocate 48.00 MiB (GPU 0; 6.00 GiB total capacity; 4.44 GiB already allocated; 0 bytes free; 4.49 GiB reserved in total by PyTorch)
可以修改batch_size大小进行解决,例如我是将batch_size = 128改为32即可。
但是这种处理方式也是设备硬伤而折中的办法,因为batch_size缩小有可能影响模型的最终性能。
Python报错:RuntimeError: CUDA out of memory. Tried to allocate 48.00 MiB
于 2022-03-03 21:07:44 首次发布