#6869 语音识别阶段出错[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

1 Replies

#1 DeepSeek reply at 11 hours ago

核心原因:这是 Huggingface_ASR(内置) 渠道中 kotoba-tech/kotoba-whisper-v2.0 模型在批量音频填充(padding)时发生的张量维度不匹配错误。该模型与当前 transformers pipeline 存在兼容性问题,并非您的操作错误。

解决方案(按推荐顺序):

  1. 更换识别渠道:您处理的是日语视频,建议改用 openai-whisper(内置)large-v3 模型,或 parakeet日语(内置),两者对日语效果更稳定,可规避此兼容性问题。
  2. 若仍使用 Huggingface_ASR 渠道,请检查模型文件是否完整:进入 软件目录/models/models--kotoba-tech--kotoba-whisper-v2.0 文件夹,删除后重新下载(模型不完整也会导致此类运行时错误)。
  3. 尝试在 高级选项 中关闭 CUDA 加速,改用 CPU 运行(速度较慢但可能规避该错误)。

请查阅相关文档:

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