在跑代码的过程中,遇到了这个问题,当前需要分配的显存在600MiB以下

RuntimeError: CUDA out of memory. Tried to allocate 60.00 MiB (GPU 0; 10.76 GiB total capacity; 8.71 GiB already allocated; 59.00 MiB free; 8.81 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
然后参考 《南溪的目标检测学习笔记》——训练PyTorch模型遇到显存不足的情况怎么办(“OOM: CUDA out of memory“)_墨门-CSDN博客
减小batch_size的数量
最小的数量可以设置为2;
本文目的:修改batch_size,在哪修改batch_size呢?
在train.py文件下,参数设置:

本文针对PyTorch模型训练中出现的显存不足问题提供了解决方案。建议通过减少batch_size来避免CUDA显存溢出错误,并探讨了不同batch_size设置对训练的影响。

7866

被折叠的 条评论
为什么被折叠?



