#8704 语音识别阶段出错[openai-whisper(内置)] [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried

36.142**9 Posted at: 16 hours ago

语音识别阶段出错[openai-whisper(内置)] [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 2928721152 bytes.:Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 65, in openai_whisper
File "whisper\transcribe.py", line 139, in transcribe
File "whisper\audio.py", line 148, in log_mel_spectrogram
File "F:\BaiduNetdiskDownload\win-pyvideotrans-v4.18-1106\_internal\torch\functional.py", line 730, in stft

return _VF.stft(  # type: ignore[attr-defined]

RuntimeError: [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 2928721152 bytes.

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 84, in run
File "videotrans\task\_stage_recogn.py", line 64, in recogn
File "videotrans\recognition\__init__.py", line 148, in run
File "videotrans\recognition\_base.py", line 101, in run
File "videotrans\recognition\_whisper.py",
......
line 85, in _openai
File "videotrans\configure\base.py", line 291, in _new_process
videotrans.configure.excepts.VideoTransError: [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 2928721152 bytes.:Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 65, in openai_whisper
File "whisper\transcribe.py", line 139, in transcribe
File "whisper\audio.py", line 148, in log_mel_spectrogram
File "F:\BaiduNetdiskDownload\win-pyvideotrans-v4.18-1106\_internal\torch\functional.py", line 730, in stft

return _VF.stft(  # type: ignore[attr-defined]

RuntimeError: [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 2928721152 bytes.

trk=翻译视频 单视频模式
选择音视频文件: E:/jj/Download/SAP CPI Full Course/1.SAP CPI Full Course_25966939885.aac,
输出目录: E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac,
self.cfg.cache_folder='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75'
已选 清理已生成, 未选 CUDA加速
语音识别:openai-whisper(内置), tiny, 发音语言: 英语
最长语音持续(秒): 5s
最短语音持续(毫秒): 3000ms
静音分割持续毫秒: 600ms
语音阈值: 0.45
选择VAD: silero
翻译渠道:Google(免费),发音语言:英语,目标语言:简体中文
传统翻译渠道每批字幕行数: 5
Dont dubbing: self.cfg.voice_role='No'
不嵌入字幕
video duration:18183430ms
video information:{'video_fps': 30, 'r_frame_rate': 30, 'video_codec_name': '', 'audio_codec_name': 'aac', 'width': 0, 'height': 0, 'time': 18183430, 'streams_len': 1, 'streams_audio': 1, 'video_streams': 0, 'color': 'yuv420p'}
self.cfg=TaskCfgVTT(uuid='5f2270cf75', name='E:/jj/Download/SAP CPI Full Course/1.SAP CPI Full Course_25966939885.aac', dirname='E:/jj/Download/SAP CPI Full Course', noextname='1.SAP CPI Full Course_25966939885', basename='1.SAP CPI Full Course_25966939885.aac', ext='aac', target_dir='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac', cache_folder='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75', is_cuda=False, source_language='英语', source_language_code='en', source_sub='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac/en.srt', source_wav='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75/en.wav', source_wav_output='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac/en.m4a', target_language='简体中文', target_language_code='zh-cn', target_sub='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac/zh-cn.srt', target_wav='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75/target.wav', target_wav_output='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac/zh-cn.m4a', translate_type=0, tts_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='No', voice_autorate=True, video_autorate=False, remove_silent_mid=False, align_sub_audio=True, detect_language='en', recogn_type=1, model_name='tiny', shibie_audio=None, remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=False, fix_punc=0, app_mode='biaozhun', subtitle_language=None, targetdir_mp4='E:/jj/Download/SAP CPI Full Course/_video_out/1.SAP CPI Full Course_25966939885-aac/1.SAP CPI Full Course_25966939885.mp4', novoice_mp4='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75/novoice.mp4', is_separate=False, embed_bgm=True, instrument='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75/instrument.wav', vocal='F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106/tmp/22548/5f2270cf75/vocal.wav', clear_cache=True, background_music='', subtitle_type=0, only_out_mp4=False, recogn2pass=False, output_srt=0, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8, batch=False)
video_duration_ms=18183430


=
system:Windows-10-10.0.26200-SP0
version:v4.18
frozen:True
language:zh_CN
root_dir:F:/BaiduNetdiskDownload/win-pyvideotrans-v4.18-1106

1 Replies

#1 DeepSeek reply at 16 hours ago

核心原因是 内存(RAM)不足,而非显存不足。你使用的是 openai-whisper(内置) 渠道,它会把整段音频一次性解码并生成完整的梅尔频谱(log_mel_spectrogram → torch.stft),本次音频时长约 5 小时(18183430 ms),需要一次性申请约 2.9GB 连续内存,加上模型与中间数据后超出可用物理内存,直接触发 DefaultCPUAllocator: not enough memory。

解决方案(按推荐顺序)

  1. 改用 faster-whisper(内置) 渠道

    • 该渠道基于 VAD 切片逐段处理,不会一次性加载整段音频,内存占用低,且速度更快。
    • 主界面 语音识别 下拉改为 faster-whisper(内置),模型仍可选 tiny 或 small/base。
  2. 若必须用 openai-whisper,先把长音频切分

    • 用 菜单 → 工具/选项 → 按字幕剪辑视频 或第三方工具将该 5 小时音频切成 20–30 分钟以内的多个片段,分别导入处理。
    • 单个任务时长越短,一次性内存峰值越低。
  3. 释放内存后再重试

    • 关闭浏览器等大内存占用程序,任务运行时不要同时开其他软件;重试时保持勾选 清理已生成。
  4. 模型过大也会加剧问题

    • tiny 已是最小模型,说明瓶颈是音频长度本身;此时降低模型无效,必须走方案 1 或 2。

补充说明:该视频是纯音频 .aac(video_streams: 0),最终不嵌入字幕、不配音(voice_role='No'),你实际只需转录+翻译,用 语音转录 或 翻译字幕 功能分段处理也可得到 SRT,避免长音频一次性识别。

请查阅相关文档:

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