#6242 语音识别阶段出错[Huggingface_ASR(本地内置)] CUDA out of memory. Tried to allocate 5.55 GiB. GPU 0 has a total capacity of 11.94 GiB

203.10* Posted at: 9 hours ago

语音识别阶段出错[Huggingface_ASR(本地内置)] CUDA out of memory. Tried to allocate 5.55 GiB. GPU 0 has a total capacity of 11.94 GiB of which 3.12 GiB is free. Of the allocated memory 7.62 GiB is allocated by PyTorch, and 9.37 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_pipe.py", line 97, in pipe_asr
File "C:\Users\Administrator\Desktop\win-pyvideotrans-v4.07(1)\_internal\transformers\pipelines\automatic_speech_recognition.py", line 266, in call

return super().__call__(inputs, **kwargs)

File "C:\Users\Administrator\Desktop\win-pyvideotrans-v4.07(1)\_internal\transformers\pipelines\base.py", line 1248, in call

outputs = list(final_iterator)

File "C:\Users\Administrator
......
torch\nn\modules\activation.py", line 133, in forward

return F.relu(input, inplace=self.inplace)

File "C:\Users\Administrator\Desktop\win-pyvideotrans-v4.07(1)\_internal\torch\nn\functional.py", line 1704, in relu

result = torch.relu(input)

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 5.55 GiB. GPU 0 has a total capacity of 11.94 GiB of which 3.12 GiB is free. Of the allocated memory 7.62 GiB is allocated by PyTorch, and 9.37 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='a7024a7428', name='C:/Users/Administrator/Desktop/[bbs.yzkof.com]MOMJ-128.720P A[约战竞技场].mp4', dirname='C:/Users/Administrator/Desktop', noextname='[bbs.yzkof.com]MOMJ-128.720P A[约战竞技场]', basename='[bbs.yzkof.com]MOMJ-128.720P A[约战竞技场].mp4', ext='mp4', target_dir='C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)/output/recogn', cache_folder='C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)/tmp/17912/a7024a7428', 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='C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)/output/recogn/[bbs.yzkof.com]MOMJ-128.720P A[约战竞技场].srt', target_wav=None, target_wav_output=None, detect_language='ja', recogn_type=8, model_name='nvidia/parakeet-ctc-1.1b', shibie_audio='C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)/tmp/17912/a7024a7428/[bbs.yzkof.com]MOMJ-128.720P A[约战竞技场]-1785669011.6671953.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=0)


=
system:Windows-10-10.0.19045-SP0
version:v4.07
frozen:True
language:zh
root_dir:C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)

1 Replies

这是典型的显卡显存不足(CUDA out of memory)导致的。你的显卡总显存约 12GB,但 nvidia/parakeet-ctc-1.1b 模型加载后已占用约 7.62GB,剩余可用仅 3.12GB,当尝试再分配 5.55GB 时直接崩溃。

此外还有一个配置问题:你选择了 nvidia/parakeet-ctc-1.1b,该模型只支持英语(['en']),但任务语言是日语(detect_language='ja'),模型与语言不匹配。

解决方案(按优先顺序执行):

  1. 改用支持日语的识别模型:日语识别建议使用 parakeet日语(内置) 渠道,或 openai-whisper(内置) / faster-whisper(内置) 并选择 large-v3 / large-v3-turbo 模型,不要用只支持英语的 parakeet-ctc-1.1b 识别日语。
  2. 降低显存占用:进入 菜单 -> 工具 -> 高级选项 -> 语音识别参数

    • 计算数据类型 改为 float16(最适合显卡)或 int8(最省显存);
    • 识别准确度beam_size识别准确度best_of 均调低为 1
    • 关闭 启用上下文感知 选项。
  3. 关闭其他占用显存的程序:检查并退出其他可能占用 GPU 的程序(浏览器、游戏、其他AI工具等),释放更多显存。
  4. 若仍失败,可临时不勾选 CUDA加速,改用 CPU 模式:速度会显著变慢,但可避免因显存不足而中断。
  5. 换用更小显存需求的模型:使用 faster-whisper(内置)smallmedium 模型,可明显降低显存需求。

请查阅相关文档:

Post Your Reply
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

Dondate via PayPal

Related resource