#6993 语音识别阶段出错[阿里FunASR(本地内置)] CUDA out of memory. Tried to allocate 9.78 GiB. GPU 0 has a total capacity of 31.86 GiB of whic

125.67**9 Posted at: 58 minutes ago

语音识别阶段出错[阿里FunASR(本地内置)] CUDA out of memory. Tried to allocate 9.78 GiB. GPU 0 has a total capacity of 31.86 GiB of which 7.40 GiB is free. Of the allocated memory 23.38 GiB is allocated by PyTorch, and 186.63 MiB 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):Traceback (most recent call last):
File "videotrans\process\stt_funasr.py", line 76, in funasr_mlt
File "funasr\auto\auto_model.py", line 324, in generate

return self.inference(

File "funasr\auto\auto_model.py", line 381, in inference

res = model.inference(**batch, **kwargs)

File "D:\BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07/videotrans/codes\model.py", line 610, in inference

return self.inference_llm(

File "D:\BaiduNetdiskDownload/pyVideoTrans/win-pyvide
......
rans\win-pyvideotrans-v4.07\_internal\funasr\models\transformer\attention.py", line 90, in forward_attention

attn = torch.softmax(scores, dim=-1).masked_fill(

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 9.78 GiB. GPU 0 has a total capacity of 31.86 GiB of which 7.40 GiB is free. Of the allocated memory 23.38 GiB is allocated by PyTorch, and 186.63 MiB 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)
cfg=TaskCfgSTT(uuid='74ee6fa600', name='D:/BaiduNetdiskDownload/配乐插件教程/The Score/05.SONUSCORE-THE SCORE Preset Playthrough_1080p.mp4', dirname='D:/BaiduNetdiskDownload/配乐插件教程/The Score', noextname='05.SONUSCORE-THE SCORE Preset Playthrough_1080p', basename='05.SONUSCORE-THE SCORE Preset Playthrough_1080p.mp4', ext='mp4', target_dir='D:/BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07/output/recogn', cache_folder='D:/BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07/tmp/19288/74ee6fa600', is_cuda=True, source_language=None, source_language_code=None, source_sub=None, source_wav=None, source_wav_output=None, target_language=None, target_language_code=None, target_sub='D:/BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07/output/recogn/05.SONUSCORE-THE SCORE Preset Playthrough_1080p.srt', target_wav=None, target_wav_output=None, detect_language='en', recogn_type=3, model_name='Fun-ASR-Nano-2512', shibie_audio='D:/BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07/tmp/19288/74ee6fa600/05.SONUSCORE-THE SCORE _ Preset Playthrough_1080p-1788193144.456531.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=0)


=
system:Windows-10-10.0.26100-SP0
version:v4.07
frozen:True
language:zh
root_dir:D:/BaiduNetdiskDownload/pyVideoTrans/win-pyvideotrans-v4.07

1 Replies

#1 DeepSeek reply at 58 minutes ago

这是显存不足导致的。您的 GPU 总容量 31.86GB,但已有 23.38GB 被 PyTorch 占用,剩余空闲只有 7.40GB,而 FunASR 本次又需要 9.78GB,故分配失败。

解决方案按顺序尝试:

  1. 关闭其他占用 GPU 的软件,并重启 pyVideoTrans,释放显存碎片和残留占用。
  2. 进入「菜单 → 工具 → 高级选项 → 通用设置」,将「GPU同时任务数」设为 1,避免多任务争抢显存。
  3. 对于英文视频,不建议使用阿里 FunASR(本地内置),该渠道主要针对中文优化且模型较大、显存需求高。请改用 faster-whisper(内置),模型选择 large-v3-turbo 或更小的 small/medium,速度和显存占用更均衡。
  4. 若仍要坚持使用 FunASR,可在「高级选项-语音识别参数」中尝试将「计算数据类型」设为 int8 或 float16 以减少显存占用,但不能保证一定有效。
  5. 也可以临时取消勾选「CUDA加速」,改为 CPU 识别,虽速度慢但不会报显存错误。
  6. 若以上均不行,请删除本地模型重新下载,排除模型损坏导致的异常内存分配。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource