#5477 cfg=TaskCfgSTT(uuid='6f1ee0d9fa', name='D:/张建光/姜胡说/2021年/@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值....mp4', dirname='D:/张建

106.35* Posted at: 1 hour ago

语音识别阶段出错[Qwen-ASR(本地内置)] CUDA out of memory. Tried to allocate 24.00 MiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 3.42 GiB is allocated by PyTorch, and 37.81 MiB 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_fun.py", line 544, in qwen3asr_fun
File "D:\download\pyVideoTrans\_internal\qwen_asr\inference\qwen3_asr.py", line 206, in from_pretrained

model = AutoModel.from_pretrained(pretrained_model_name_or_path, **kwargs)

File "transformers\models\auto\auto_factory.py", line 604, in from_pretrained

return model_class.from_pretrained(

File "transformers\modeling_utils.py", line 277, in _wrapper

return func(*args, **kwarg

......
allocated by PyTorch, and 37.81 MiB 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\task\job.py", line 35, in run

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

File "videotrans\task\speech2text.py", line 97, in recogn

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

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

File "videotrans\recognition\_qwenasrlocal.py", line 45, in _exec

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

videotrans.configure.excepts.VideoTransError: CUDA out of memory. Tried to allocate 24.00 MiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 3.42 GiB is allocated by PyTorch, and 37.81 MiB 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_fun.py", line 544, in qwen3asr_fun
File "D:\download\pyVideoTrans\_internal\qwen_asr\inference\qwen3_asr.py", line 206, in from_pretrained

model = AutoModel.from_pretrained(pretrained_model_name_or_path, **kwargs)

File "transformers\models\auto\auto_factory.py", line 604, in from_pretrained

return model_class.from_pretrained(

File "transformers\modeling_utils.py", line 277, in _wrapper

return func(*args, **kwargs)

File "transformers\modeling_utils.py", line 5048, in from_pretrained

) = cls._load_pretrained_model(

File "transformers\modeling_utils.py", line 5468, in _load_pretrained_model

_error_msgs, disk_offload_index = load_shard_file(args)

File "transformers\modeling_utils.py", line 843, in load_shard_file

disk_offload_index = _load_state_dict_into_meta_model(

File "torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "transformers\modeling_utils.py", line 750, in _load_state_dict_into_meta_model

param = param.to(casting_dtype)

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 24.00 MiB. GPU 0 has a total capacity of 4.00 GiB of which 0 bytes is free. Of the allocated memory 3.42 GiB is allocated by PyTorch, and 37.81 MiB 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)
cfg=TaskCfgSTT(uuid='6f1ee0d9fa', name='D:/张建光/姜胡说/2021年/@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值....mp4', dirname='D:/张建光/姜胡说/2021年', noextname='@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值...', basename='@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值....mp4', ext='mp4', target_dir='D:/download/pyVideoTrans/output/recogn', cache_folder='D:/download/pyVideoTrans/tmp/10384/6f1ee0d9fa', is_cuda=True, source_language=None, source_language_code=None, source_sub=None, source_wav=None, source_wav_output=None, target_language=None, target_language_code=None, target_sub='D:/download/pyVideoTrans/output/recogn/@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值....srt', target_wav=None, target_wav_output=None, detect_language='zh-cn', recogn_type=2, model_name='1.7B', shibie_audio='D:/download/pyVideoTrans/tmp/10384/6f1ee0d9fa/@姜胡说_20201008_我Z核心的底层方法之一_建议多看几遍_刻意练习_值...-1782386957.9285924.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=0)


=
system:Windows-10-10.0.26200-SP0
version:v4.03
frozen:True
language:zh
root_dir:D:/download/pyVideoTrans

1 Replies

这是显卡显存不足导致的错误。你的 GPU(NVIDIA 显卡)总显存仅有 4.0 GiB,而 Qwen-ASR(1.7B 参数版本)加载后已用 3.42 GiB,剩余空间无法分配额外的 24 MiB,因此直接崩溃。

解决方法(按推荐顺序尝试):

  1. 切换为更节省显存的本地识别渠道:推荐使用 faster-whisper(本地) 并选择 tinybase 模型,这两个模型在 4GB 显存下通常能正常运行。

    • 在主界面第 2 行“语音识别渠道”中选择 faster-whisper(本地),模型选 tinybase
  2. 关闭 CUDA 加速:如果不介意处理速度变慢,可取消勾选主界面上的“CUDA加速”复选框,软件将使用 CPU 运行本地模型,完全避免显存不足问题。

    • 注意:CPU 模式下处理速度会显著降低,但至少能完成任务。
  3. 调整高级选项(可选):在 菜单→工具→高级选项→语音识别参数 中,将 计算数据类型 设为 int8(最省显存),并降低 beam_sizebest_of 至 1,可略微减少显存占用,但显存 4GB 运行 1.7B 模型仍然紧张,不保证成功。

建议优先采用方案 1 或方案 2。

请查阅相关文档:

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: ko-fi.com/jianchang512

Related resource

Similar issues already exist