#7043 语音识别阶段出错[faster-whisper(内置)] Unable to allocate 1.06 GiB for an array with shape (1, 708763, 400) and data type float32:

240e**7a9d Posted at: 2 hours ago

语音识别阶段出错[faster-whisper(内置)] Unable to allocate 1.06 GiB for an array with shape (1, 708763, 400) and data type float32:Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 164, in faster_whisper
File "faster_whisper\transcribe.py", line 916, in transcribe
File "faster_whisper\feature_extractor.py", line 215, in call
File "faster_whisper\feature_extractor.py", line 171, in stft
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 1.06 GiB for an array with shape (1, 708763, 400) and data type float32

Traceback (most recent call last):

File "videotrans\task\job.py", line 35, in run

File "videotrans\task\job.py", line 102, in process_task

File "videotrans\task\_stage_recogn.py", line 63, in recogn

File "videotrans\recognition\__init__.py", line 211, in run

File "videotrans\recognition\_base.py", line 98, in run

File "videotrans\recognition\_whisper.py", line 41, in _exec

File "videotrans\recognition\_whisper.py", line 130, in _faster

File "videotrans\configure\base.py", line 270, in _new_process

videotrans.configure.excepts.VideoTransError: Unable to allocate 1.06 GiB for an array with shape (1, 708763, 400) and data type float32:Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 164, in faster_whisper
File "faster_whisper\transcribe.py", line 916, in transcribe
File "faster_whisper\feature_extractor.py", line 215, in call
File "faster_whisper\feature_extractor.py", line 171, in stft
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 1.06 GiB for an array with shape (1, 708763, 400) and data type float32
[TransCreate]翻译视频: self.is_copy_video=True,self.video_codec_num=264,self.is_audio_trans=False,self.video_info={'video_fps': 30.0, 'r_frame_rate': 30.0, 'video_codec_name': 'h264', 'audio_codec_name': 'aac', 'width': 1920, 'height': 1080, 'time': 7223800, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
[TaskCfgVTT]当前工作模式: 翻译视频 批量翻译模式
原始输入文件名: D:/py-/bs/01如何让自己牢不可破 _ Huberman 实验室.mp4,
输出结果保存到文件夹: D:/py-/01如何让自己牢不可破 _ Huberman 实验室-mp4,
临时文件夹: D:/sp/tmp/22912/23c8a9d870
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:faster-whisper(内置), large-v3, 发音语言: 英语, 断句方式:默认断句
翻译渠道:Google(免费),原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Edge-TTS(免费), 角色:Yunyang(Male/CN), 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+20%, 已选 音频加速, 已选 视频慢速
字幕: 嵌入硬字幕
已选 仅输出mp4


=
system:Windows-10-10.0.26200-SP0
version:v4.11
frozen:True
language:zh
root_dir:D:/sp

1 Replies

#1 DeepSeek reply at 2 hours ago

这是系统内存不足导致的,不是显存问题。faster-whisper 在特征提取阶段需要为整个音频一次性分配浮点矩阵(报错要求约 1.06GiB),你的视频时长约 2 小时,音频过长时内存峰值会耗尽。

解决步骤

  1. 关闭其他占用内存的程序,特别是浏览器、大型软件。
  2. 增大 Windows 虚拟内存:右键“此电脑” → 属性 → 高级系统设置 → 设置 → 高级 → 虚拟内存 → 手动分配,建议设为物理内存的 1.5~2 倍。
  3. 勾选“Whisper预分割音频”(关键):在 菜单 → 工具/选项 → 高级选项 → 语音识别参数 中勾选“Whisper预分割音频?”,这会先按语音停顿切分音频再识别,显著降低单次内存峰值。
  4. 同步调整识别参数:在“语音识别参数”中设置“最长语音持续(秒)”为 6~10,“最短语音持续(毫秒)”为 3000~4000,并勾选“合并过短字幕到邻近”。
  5. 若仍内存紧张:将模型从 large-v3 改为 large-v3-turbomedium,精度略有下降但内存占用大幅减少。
  6. 注意:你已启用 CUDA 加速,但该报错发生在 CPU 特征提取阶段,与 CUDA 无关,无需关闭。

请查阅相关文档:

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