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

该错误是音频输入长度超过模型最大处理限制导致的。kotoba-whisper-v2.0 模型期望的输入特征长度为 3000 帧(约 30 秒),但实际输入达到了 8363 帧,说明切片时长过长,模型无法正确处理。

按以下步骤排查:

  1. 进入 菜单 → 工具 → 高级选项 → 语音识别参数,将 最长语音持续(秒) 改为 30,并勾选 Whisper预分割音频?,然后重新执行。
  2. 如果仍有问题,建议更换为其他支持日语的识别渠道,如 openai-whisper(内置) 选择 large-v3 模型,或 parakeet日语(内置)faster-whisper(内置)
  3. 同时检查模型文件是否下载完整:删除 软件目录/models/models--kotoba-tech--kotoba-whisper-v2.0 文件夹,重新让软件自动下载,或按 https://pyvideotrans.com/aboutmodels 手动下载覆盖。

若以上操作后仍报错,请提供 logs/ 目录下最新日志文件的完整内容以便进一步分析。

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