Out of memory error on GPU 0. Cannot allocate xxxGB memory on GPU 0, available memory is only xxx

本人刚刚入手cv,见解浅陋,如有不对请多多包含。

根据从网上查找的资料,遇到这种情况一般有以下几种解决方法:

1.在程序运行的前面添加如下代码

os.environ[‘FLAGS_eager_delete_tensor_gb’] = “0.0”

但是对我好像没有用。

2.如果是在多卡的环境下运行的出现错误设置CUDA_VISIBLE_DEVICES=”0″ 选择要使用的显卡

但是本人的烂笔记本只有一个显卡QAQ

3.减小模型的batch_size

亲测有用!我使用paddlepaddle跑yolo3,在yolo3_reader.yml文件中找到了batch

_size,原先维8,我改成了1。

Out of memory error on GPU 0. Cannot allocate xxxGB memory on GPU 0, available memory is only xxx

然后重启了一下电脑就成功了。

4.使用命令行的同学还可以试一下这个:

Out of memory error on GPU 0. Cannot allocate xxxGB memory on GPU 0, available memory is only xxx

但是因为本人不使用命令行,就不知道是否可行了。

Original: https://blog.csdn.net/zhuzyibooooo/article/details/123516407
Author: Encounter84
Title: Out of memory error on GPU 0. Cannot allocate xxxGB memory on GPU 0, available memory is only xxx

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/628568/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球