#6867 语音识别阶段出错[Huggingface_ASR(内置)] The expanded size of the tensor (3000) must match the existing size (8363) at non-singleto

171.91.**5 Posted at: 11 hours ago

语音识别阶段出错[Huggingface_ASR(内置)] The expanded size of the tensor (3000) must match the existing size (8363) at non-singleton dimension 1. Target sizes: [128, 3000]. Tensor sizes: [128, 8363]:Traceback (most recent call last):
File "videotrans\process\stt_pipe.py", line 94, in pipe_asr
File "D:\win-pyvideotrans-v4.11\_internal\transformers\pipelines\automatic_speech_recognition.py", line 244, in call

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

File "D:\win-pyvideotrans-v4.11\_internal\transformers\pipelines\base.py", line 1245, in call

outputs = list(final_iterator)

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

item = next(self.iterator)

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

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

File "D:\win-pyvideotrans-v4.11\_internal\torch\utils\data\dataloader.py", line 733, in next
......
\transformers\pipelines\automatic_speech_recognition.py", line 244, in call

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

File "D:\win-pyvideotrans-v4.11\_internal\transformers\pipelines\base.py", line 1245, in call

outputs = list(final_iterator)

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

item = next(self.iterator)

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

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

File "D:\win-pyvideotrans-v4.11\_internal\torch\utils\data\dataloader.py", line 733, in next

data = self._next_data()

File "D:\win-pyvideotrans-v4.11\_internal\torch\utils\data\dataloader.py", line 789, in _next_data

data = self._dataset_fetcher.fetch(index)  # may raise StopIteration

File "D:\win-pyvideotrans-v4.11\_internal\torch\utils\data\_utils\fetch.py", line 43, in fetch

return self.collate_fn(data)

File "D:\win-pyvideotrans-v4.11\_internal\transformers\pipelines\base.py", line 173, in inner

padded[key] = _pad(items, key, _padding_value, padding_side)

File "D:\win-pyvideotrans-v4.11\_internal\transformers\pipelines\base.py", line 109, in _pad

tensor[i, : len(item[key][0])] = item[key][0]

RuntimeError: The expanded size of the tensor (3000) must match the existing size (8363) at non-singleton dimension 1. Target sizes: [128, 3000]. Tensor sizes: [128, 8363]
[SpeechToText]语音转录: self.out_format='srt',self.copysrt_rawvideo=True,self.spk_insert=True
[TaskCfgSTT]
原始输入文件名: F:/超爱/URE-137CX/[email protected]4,
输出结果保存到文件夹: D:/BaiduNetdiskDownload/win-pyvideotrans-v4.11/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.11/tmp/2500/22ff35351a
已启用CUDA加速
未选 降噪
语音识别:Huggingface_ASR(内置), kotoba-tech/kotoba-whisper-v2.0 断句方式:默认断句
发音语言:ja
未选 降噪


=
system:Windows-10-10.0.19045-SP0
version:v4.11
frozen:True
language:zh
root_dir:D:/win-pyvideotrans-v4.11

3 Replies

#1 DeepSeek reply at 11 hours ago

这是 Huggingface pipeline 批量填充时,音频切片长度超出了模型固定输入尺寸(Whisper 类模型通常为 30 秒,对应特征长度 3000,而实际切片为 8363),导致维度不匹配。

请按顺序尝试:

  1. 调整语音识别切片参数:进入 菜单 → 工具 → 高级选项 → 语音识别参数,将「最长语音持续(秒)」设置为 30 或更小(如 10~20);同时勾选「Whisper预分割音频」,让音频在送入模型前被强制切分。
  2. 更换更稳定的识别渠道kotoba-whisper-v2.0 基于 Whisper 架构,对超长切片兼容性较差。日本语翻译建议改用:

    • faster-whisper(内置) + 模型 large-v3-turbolarge-v3(速度与质量兼顾)
    • parakeet日语(内置)(英伟达开源日语模型,效果较好)
  3. 检查模型完整性:若上述无效,删除 models/models--kotoba-tech--kotoba-whisper-v2.0 目录后重新下载模型,确认模型文件未损坏。

若仍无法解决,请提供 logs/ 目录下最新日志文件底部约 30 行,以便进一步分析。

#2 171.91.**5 reply at 11 hours ago

使用了parakeet日语(内置) 勾选了加速 但是为什么还是出现CPU在跑

#3 DeepSeek reply at 11 hours ago

parakeet日语(内置) 渠道不支持 CUDA/GPU 加速,属于纯 CPU 运行,因此即使勾选了 CUDA 加速,实际仍会使用 CPU。
这是因为该渠道基于英伟达开源模型的 ONNX/CPU 推理实现,未集成 GPU 加速模块。

如需 GPU 加速,请改用以下支持 CUDA 的识别渠道(需确保已正确配置 NVIDIA 显卡、CUDA 12.8+ 和 cuDNN 9.11+,并在主界面勾选“CUDA 加速”):

  • faster-whisper(内置)(推荐模型:large-v3-turbo 或 large-v3)
  • openai-whisper(内置)(模型 large-v3)
  • Huggingface_ASR(内置) 中的某些模型(如 openai/whisper-large-v3)

若仍希望使用 parakeet 日语模型,可接受 CPU 处理,但速度会较慢。必要时可改用 faster-whisper 搭配 large-v3 模型,效果和速度更优。

Thinking...
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 via ko-fi.com

Related resource