#6761 语音识别阶段出错[Qwen-ASR(内置)] CUDA out of memory. Tried to allocate 1.42 GiB. GPU 0 has a total capacity of 4.00 GiB of which 0

2409:**:9757 Posted at: 3 hours ago

语音识别阶段出错[Qwen-ASR(内置)] CUDA out of memory. Tried to allocate 1.42 GiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 7.96 GiB is allocated by PyTorch, and 2.07 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):Traceback (most recent call last):
File "videotrans\process\stt_qwen.py", line 56, in qwen3asr_fun
File "D:\win-pyvideotrans-v4.10\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "qwen_asr\inference\qwen3_asr.py", line 383, in transcribe

raw_outputs = self._infer_asr(chunk_ctx, chunk_wavs, chunk_lang)

File "qwen_asr\inference\qwen3_asr.py", line 485, in _infer_asr

return self._infer_asr_transformers(contexts, wavs, languages

......
call(args, *kwargs)
File "D:\win-pyvideotrans-v4.10\_internal\transformers4576\utils\deprecation.py", line 172, in wrapped_func

return func(*args, **kwargs)

File "qwen_asr\core\transformers_backend\modeling_qwen3_asr.py", line 262, in forward

hidden_states, _ = self.self_attn(

File "D:\win-pyvideotrans-v4.10\_internal\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl

return self._call_impl(*args, **kwargs)

File "D:\win-pyvideotrans-v4.10\_internal\torch\nn\modules\module.py", line 1762, in _call_impl

return forward_call(*args, **kwargs)

File "D:\win-pyvideotrans-v4.10\_internal\transformers4576\utils\deprecation.py", line 172, in wrapped_func

return func(*args, **kwargs)

File "qwen_asr\core\transformers_backend\modeling_qwen3_asr.py", line 204, in forward

attn_output, attn_weights = attention_interface(

File "D:\win-pyvideotrans-v4.10\_internal\transformers4576\integrations\sdpa_attention.py", line 96, in sdpa_attention_forward

attn_output = torch.nn.functional.scaled_dot_product_attention(

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 1.42 GiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 7.96 GiB is allocated by PyTorch, and 2.07 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)
[SpeechToText]语音转录: self.out_format='srt',self.copysrt_rawvideo=False,self.spk_insert=False
[TaskCfgSTT]
原始输入文件名:



**.mp4,
输出结果保存到文件夹: D:/win-pyvideotrans-v4.10/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.10/tmp/23728/33bb29acde
已启用CUDA加速
未选 降噪
语音识别:Qwen-ASR(内置), 1.7B 断句方式:默认断句
发音语言:ja
未选 降噪


=
system:Windows-10-10.0.22631-SP0
version:v4.10
frozen:True
language:zh
root_dir:D:/win-pyvideotrans-v4.10

1 Replies

#1 DeepSeek reply at 3 hours ago

这是显卡显存不足导致的。你的 GPU 总显存只有 4GB,而 Qwen-ASR 1.7B 模型在推理时整体内存需求已超过 8GB(报错显示 PyTorch 已分配 7.96 GiB),远超物理显存上限,因此触发 CUDA out of memory

解决办法:

  1. 将 Qwen-ASR 模型从 1.7B 切换为 0.6B:在语音识别渠道中 Qwen-ASR(内置) 模型选择 0.6B 版本,显存占用会明显下降。
  2. 改用更省显存的识别渠道:4GB 显存下推荐使用 faster-whisper(内置)smallbase 模型(占用约 1-2GB);若仍不足,可继续降为 tiny
  3. 关闭 CUDA 加速:如果必须使用 Qwen-ASR 1.7B 且显存无法满足,可取消勾选 CUDA 加速,改用 CPU 运行(速度较慢,但可避免显存溢出)。

请查阅相关文档:

Thinking...
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

Related resource