runtimeerror53filenotfound翻译(RuntimeError: CUDA out of memory 已解决)
先说下我的电脑环境:win10 3060ti torch10 python3.8 cuda11.3
RuntimeError: CUDA out of memory. Tried to allocate 128.00 MiB (GPU 0; 23.70 GiB total capacity; 7.44 GiB already allocated; 87.88 MiB free; 7.71 GiB 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
训练一个很小的网络的时候 ,报了一个这个错 ,很奇怪,看了一下以为是显存不够的原因 ,但是很矛盾 ,之前训练过transformer ,不可能是这个原因 。
通过网络上找来找去 ,众说纷纭
降低Dataloader中的batch_size import gc 清除cuda显存中的缓存 不让图片送入cuda ,这个很明显没有意义 降低torch版本 不采用预训练模型上述在我这里都不通 , 我最终的解决方案来自这个链接中的一个回复 CUDA out of memory
降低了图片的像素 ,最开始的像素是2400x2400 ,resize到400x400后就可以玩耍了
因为是目标检测任务 ,resize图片后,label位置也需要进行改变 ,这里附上一篇不错的博客 ,希望可以帮到你:label随着resize而改变创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!