RuntimeError: CUDA out of memory See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

这篇具有很好参考价值的文章主要介绍了RuntimeError: CUDA out of memory See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

报错:
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

当reserved memory is >> allocated memory,进行如下设置,可解决此bug:
代码如下:文章来源地址https://www.toymoban.com/news/detail-506183.html

import os
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128"

到了这里,关于RuntimeError: CUDA out of memory See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • AI绘画——使用stable-diffusion生成图片时提示RuntimeError: CUDA out of memory处理方法

    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_

    2024年02月02日
    浏览(40)
  • 解决:RuntimeError: CUDA out of memory. Tried to allocate 160.00 MiB (GPU 0; 10.76 GiB total capacity..

    完整报错:   问题分析: 内存分配不足: 需要160MB,,但GPU只剩下135.31MB。 解决办法: 1.减小batch_size。注意batchsize的调整要配合学习率的调整,一般是正比关系,BS增大两倍,LR增大两倍或者根号二倍。减小也是相应更改。 2.运行torch.cuda.empty_cache()函数。加在训练开始前即可

    2024年02月16日
    浏览(32)
  • CUDA报错:Out of Memory

    如果报错里提示Pytorch reserved的内存远大于Already allocated的内存,那么就是因为分配显存时单位过大,导致出现大量内存碎片无法继续分配(与操作系统内存管理同理)。 我们可以限制一次分配的最大单位来解决这个问题。 随后代码便可正常运行了。

    2024年02月15日
    浏览(48)
  • torch.cuda.OutOfMemoryError: CUDA out of memory.

    训练清华ChatGLM-6B时报错, 原因是显存不够 torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 96.00 MiB (GPU 0; 23.70 GiB total capacity; 4.37 GiB already allocated; 64.81 MiB free; 4.37 GiB reserved in total by PyTorch) If reserved memory is allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentatio

    2024年02月06日
    浏览(34)
  • 【CUDA OUT OF MEMORY】【Pytorch】计算图与CUDA OOM

    在实践过程中多次碰到了CUDA OOM的问题,有时候这个问题是很好解决的,有时候DEBUG一整天还是头皮发麻。 最近实践对由于计算图积累导致CUDA OOM有一点新的看法,写下来记录一下。 包括对计算图的一些看法和一个由于计算图引发错误的简化实例记录。 本人能力有限,认识片

    2024年02月09日
    浏览(27)
  • Pycharm报错torch.cuda.OutOfMemoryError: CUDA out of memory.

    报错 做深度学习相关的实验,可以看到我的显卡内存很小(哭了,不过我有时候是在别的电脑上做的,那个电脑比这个好用),网上搜到的说的 max_split_size_mb:128 这个方法我贴到我代码上之后没有效果。 因为我在这个电脑上做的是主实验后面的一些对比实验,也就是代码中很

    2024年02月05日
    浏览(33)
  • 部署stable diffusion 错误torch.cuda.OutOfMemoryError: CUDA out of memory.

    以来安装完毕,开始执行web_ui.bat 错误截图:  猜测原因:GPU用错了 webUI.py加一行代码 在此启动web_ui.bat,成功打开网页页面

    2024年02月11日
    浏览(37)
  • 【已解决】探究CUDA out of memory背后原因,如何释放GPU显存?

    研究过深度学习的同学,一定对类似下面这个CUDA显存溢出错误不陌生 RuntimeError: CUDA out of memory. Tried to allocate 916.00 MiB (GPU 0; 6.00 GiB total capacity; 4.47 GiB already allocated; 186.44 MiB free; 4.47 GiB reserved in total by PyTorch) 本文探究CUDA的内存管理机制,并总结该问题的解决办法 在实验开始前

    2023年04月20日
    浏览(87)
  • Stable Diffusion WebUI内存不够爆CUDA Out of memory怎么办?

    在我们运行SD的时候,我们经常会爆CUDA Out of memory。 我们应该怎么办呢? 这是因为我们的显存或者内存不够了。 如果你是用cpu来跑图的则表示内存不够,这个时候就需要换个大点的内存了。 如果你是用gpu来跑图的就说明你显存不够用咯,这时候咋办呢? 下面我将一一述说解

    2024年02月08日
    浏览(107)
  • Stable Diffusion WebUI rtx 2060 6G 高清修复 爆显存torch.cuda.OutOfMemoryError: CUDA out of memory.

    故障日志 零食解决办法,重启webui.sh进程,重新执行生成图片 日志   确实清晰不少 

    2024年02月04日
    浏览(36)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包