RuntimeError: CUDA out of memory. 错误日志

运行代码时出现的错误如下:

RuntimeError: CUDA out of memory. Tried to allocate 2.00 MiB (GPU 0; 4.00 GiB total capacity; 2.91 GiB already allocated; 166.40 KiB free; 2.93 GiB reserved in total by PyTorch)

看了一下自己的GPU在这里插入图片描述
肯定是支持代码运行的,于是看了一下自己的代码:
在这里插入图片描述
查找了其他的博文,先试了最简单的将batch_size改小了点,我改成了2,运行就成功了
在这里插入图片描述
在这里插入图片描述
现在还在运行中……

猜你喜欢

转载自blog.csdn.net/A_Tu_daddy/article/details/105396441