首页IT科技ai内部绘图工具什么情况能用(AI绘画——使用stable-diffusion生成图片时提示RuntimeError: CUDA out of memory处理方法)

ai内部绘图工具什么情况能用(AI绘画——使用stable-diffusion生成图片时提示RuntimeError: CUDA out of memory处理方法)

时间2025-06-20 09:26:18分类IT科技浏览6227
导读:提示显存不足 RuntimeError: CUDA out of memory. Tried to allocate 1.50 GiB (GPU 0; 8.00 GiB total capacity; 5.62 GiB already allocated; 109.75 MiB free...

提示显存不足

RuntimeError: CUDA out of memory. Tried to allocate 1.50 GiB (GPU 0; 8.00 GiB total capacity; 5.62 GiB already allocated; 109.75 MiB free; 5.74 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

1              、添加参数–n_samples 1              ,其默认值为3

python scripts/txt2img.py --prompt “a photograph of an astronaut riding a horse              ” --plms –n_samples 1

2                      、降低精度

修改scripts/txt2img.py文件                     ,在model.to(device)后添加.half()

3       、结果<

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
人工智能会淘汰程序员么(人工智能这么厉害,比如GPT-4,为什么没有看到程序员失业?) 探索美食文化的作文500字(对美食的探索)