#8305 语音识别阶段出错[Huggingface_ASR(内置)] [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you trie

240e**6769 Posted at: 1 hour ago

语音识别阶段出错[Huggingface_ASR(内置)] [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 17670594560 bytes.:Traceback (most recent call last):
File "videotrans\process\stt_pipe.py", line 61, in pipe_asr
File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\pipelines\automatic_speech_recognition.py", line 247, in call

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

File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\pipelines\base.py", line 1257, in call

outputs = list(final_iterator)

File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\pipelines\pt_utils.py", line 126, in next

item = next(self.iterator)

File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\pipelines\pt_utils.py", line 271, in next

processed = self.infer(next(self.iterator), **self.params)

File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\pipelines\base.py", line 1175, in forward

model_outputs = self._

......
es = conv_layer(hidden_states)
File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\modeling_layers.py", line 93, in call

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

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

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

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

return forward_call(*args, **kwargs)

File "D:\win-pyvideotrans-v4.16-1\_internal\transformers\models\wav2vec2\modeling_wav2vec2.py", line 320, in forward

hidden_states = self.conv(hidden_states)

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

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

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

return forward_call(*args, **kwargs)

File "D:\win-pyvideotrans-v4.16-1\_internal\torch\nn\modules\conv.py", line 375, in forward

return self._conv_forward(input, self.weight, self.bias)

File "D:\win-pyvideotrans-v4.16-1\_internal\torch\nn\modules\conv.py", line 370, in _conv_forward

return F.conv1d(

RuntimeError: [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 17670594560 bytes.
trk=[SpeechToText]: uuid='92f96257fd', proxy_str=None, cfg=[TaskCfgSTT]
原始输入文件名: F:/Downloads/DCL/カリビアンコム叶あん 近親家族 パート2_2.mp4,
输出结果保存到文件夹: D:/win-pyvideotrans-v4.16-1/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.16-1/tmp/37252/92f96257fd
未启用CUDA加速
未选 降噪
语音识别:Huggingface_ASR(内置), reazon-research/japanese-wav2vec2-large-rs35kh
发音语言:ja
未选 降噪, precent=1, hasend=False, should_recogn=True, should_trans=False, should_dubbing=False, should_hebing=False, out_format='srt', copysrt_rawvideo=False, spk_insert=True


=
system:Windows-10-10.0.26300-SP0
version:v4.16
frozen:True
language:zh_CN
root_dir:D:/win-pyvideotrans-v4.16-1

1 Replies

#1 DeepSeek reply at 1 hour ago

核心原因:CPU 物理内存不足。Huggingface_ASR(内置) 调用 reazon-research/japanese-wav2vec2-large-rs35kh 这类 wav2vec2 模型时,会在内存中一次性展开整段音频的卷积特征,日志显示单次就尝试申请 17.6 GB 连续内存,被系统拒绝(DefaultCPUAllocator: not enough memory)。同时日志明确显示 未启用CUDA加速,因此全部负载压在 CPU 内存上。

解决方向(按优先级排列):

  1. 最省事:直接换识别渠道

    • 把 语音识别 改为 faster-whisper(内置),模型选 large-v3 或 large-v3-turbo。它按 VAD 切片、逐段推理,内存占用只有几 GB,日语识别质量也足够。
    • 或改用 Nemotron-3.5-asr-0.6b(内置)(支持日语,模型仅 0.6B,占用极小)。
  2. 缩短单次送入模型的音频长度
    打开 菜单 → 工具 → 高级选项 → 语音识别参数:

    • 最长语音持续(秒):由 5 调小为 3
    • 最短语音持续(毫秒):由 3000 调小为 1000
    • 静音分割持续(毫秒):由 600 调小为 300

      注意:若后续要用 clone 音色克隆,最短语音持续仍须 ≥ 3000ms。
  3. 释放内存
    处理前关闭浏览器、其他大内存程序;高级选项 → 通用设置 中把 CPU同时任务数 设为 1,并确保只跑一个任务。
  4. 能开 GPU 就开 GPU
    若机器是 NVIDIA 显卡,先按文档配好 CUDA 12.8 + cuDNN 9.11,在主界面勾选 启用CUDA加速。该渠道检测到 CUDA 可用时会优先走显存,绕开 CPU 内存瓶颈。
  5. 附带建议:先重命名文件
    当前文件名为 カリビアンコム叶あん 近親家族 パート2_2.mp4,含日文、空格与长路径,建议改为纯英文数字(如 jp_video_01.mp4)后再处理,可规避 ffmpeg 调用时的路径解析问题。

如果按上述操作后仍报同类内存错误,请提供软件目录下 logs/ 中最新日志的底部约 30 行,以及机器物理内存总量。

请查阅相关文档:

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