就是当网络参数什么都没有问题了,而且batch_size已经是最小了,还是出现以了问题

但据我遇到的RuntimeError: CUDA error: out of memoryCUDA,其实有两种,

第一种就是如下

RuntimeError: CUDA out of memory. Tried to allocate 338.00 MiB (GPU 0; 2.00 GiB total capacity; 842.86 MiB already allocated; 215.67 MiB free; 848.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

这种就是属于我选择冻结训练所导致的,就还是我电脑显卡内存不够,我就把冻结训练取消掉了,就遇到了

第二种:

RuntimeError: CUDA error: out of memory
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

第二种就是显存不够了,那我搜索了了一圈,觉得最实在的就是

使用学校提供的服务器

选择一个更好的显卡

等你有了服务器,或者一个好的显卡,就会减少很多的烦恼

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐