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

117.145* Posted at: 1 hour ago 👁7

[enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 1244659712 bytes.
Traceback (most recent call last):
File "videotrans\task\_only_one.py", line 50, in run
File "videotrans\task\trans_create.py", line 390, in recogn
File "videotrans\recognition\__init__.py", line 259, in run
File "videotrans\recognition\_base.py", line 143, in run
File "videotrans\recognition\_qwenasrlocal.py", line 48, in _exec
File "videotrans\configure\_base.py", line 289, in _new_process
RuntimeError: [enforce fail at alloc_cpu.cpp:116] data. DefaultCPUAllocator: not enough memory: you tried to allocate 1244659712 bytes.


=
system:Windows-10-10.0.22621-SP0
version:v3.99
frozen:True
language:zh
root_dir:C:/Users/98546/Desktop/win-pyvideotrans-v3.99-0508

1 Replies

这是由于系统内存不足导致的,程序尝试分配约1.2GB内存失败。常见于使用本地语音识别模型(如qwen-asr)时未启用GPU加速或内存不足。

解决方案

  1. 切换为更小的模型:在主界面将语音识别渠道从 qwen-asr(本地) 切换为 faster-whisper(本地),并选择 smallbase 模型,这些模型占用内存更少。
  2. 开启CUDA加速(前提是您有NVIDIA显卡且已安装CUDA 12.8+):务必勾选主界面上的 CUDA加速 复选框,将计算从CPU转移到GPU,大幅降低CPU内存压力。
  3. 调整高级参数:点击菜单 工具/选项高级选项语音识别参数,进行以下设置:

    • 启用 Whisper预分割音频?:选中此项(适用于faster-whisper等模型),可降低单次内存占用。
    • 如果仍使用qwen-asr,可尝试减小 beam_sizebest_of1
  4. 释放系统内存:关闭其他占用内存的软件(如浏览器、大型应用),确保系统至少有4GB可用内存。
  5. 降低视频分辨率或时长:如果处理长视频或高分辨率视频,可先使用ffmpeg压缩或切割。

若以上均无效,建议改用在线语音识别渠道(如OpenAI API、阿里百炼ASR)以减轻本地资源压力。

请查阅相关文档:

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.

Related resource