RunTime Error : cuda out of memory

骑猪看日落 2022-12-08 15:46 247阅读 0赞

cuda out of memory
分为两种情况

第一种 CUDA out of memory. Tried to allocate 16.00 MiB

在这里插入图片描述
错误信息:
CUDA out of memory. Tried to allocate 16.00 MiB (GPU 0; 7.93 GiB total capacity; 6.68 GiB already allocated; 18.06 MiB free; 41.28 MiB cached)
原因:
运行网络模型过程,占满了内存,引发中断

解决方法
减小输入输入的Batch-size
或者减小图片的尺寸

第二种 RuntimeError: CUDA error: out of memory

在这里插入图片描述
只有错误提示 out of memory
楼主google答案,发现时因为网络预训练模型和Pytorch版本不匹配

解决方法
不直接提取整个网络,只提取模型参数,这种方法要求你有这个模型的参数文件

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,247人围观)

还没有评论,来说两句吧...

相关阅读