AI软件下载
有趣网站推荐及实用软件下载

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 2.88 GiB. GPU 0 has a total capacity of 44.40 GiB of which 1.59 GiB is free. Including non-PyTorch memory,

Python应用报错:

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 2.88 GiB. GPU 0 has a total capacity of 44.40 GiB of which 1.59 GiB is free. Including non-PyTorch memory, this process has 42.80 GiB memory in use. Of the allocated memory 38.56 GiB is allocated by PyTorch, and 3.75 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

出错原因就是显存不足,报错已经提示解决方法了,设置环境变量减少内存碎片化,在Python脚本里添加如下代码:

import os
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'


AI软件用不了?2元爽玩4090: 立即体验>>

软件催更及1对1人工答疑支持: https://nuowa.net/1806
赞(0) 打赏
软件无法使用?点击查看常见问题说明>>

最近更新

FunASR语音识别转文字软件区分说话人版-诺瓦小站

FunASR语音识别转文字软件区分说话人版

FunASR是一款优秀的基础语音识别框架,配合阿里通义团队开发的其它语音识别模型,能够实现非常好语音转文字效果,尤其在中文语音识别方面,鉴于有些用户需要对语音识别内容区分说话人,我重新做了一版区分说话人的版本。软件支持多语言识别,但是还是尽...

觉得文章对你有帮助就打赏一下作者

非常感谢你的打赏,我将有更多的动力继续提供优质内容,让我们一起创建更加美好的世界!

支付宝扫一扫

微信扫一扫