#5841 The expanded size of the tensor (3225) must match the existing size (3000) at non-singleton dimension 1. Target sizes:

36.163* Posted at: 11 hours ago

The expanded size of the tensor (3225) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3225]. Tensor sizes: [128, 3000]:Traceback (most recent call last):
File "videotrans\process\_stt_pipe.py", line 97, in pipe_asr
File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\automatic_speech_recognition.py", line 266, in call

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\base.py", line 1248, in call

outputs = list(final_iterator)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\pt_utils.py", line 126, in next

item = next(self.iterator)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\pt_utils.py", line 271, in next

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\torch\utils\data\dataloader.py", line 733, in next

data = self._next_data()

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_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.05-0711\_internal\torch\utils\data\_utils\fetch.py", line 43, in fetch

return self.collate_fn(data)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\base.py", line 173, in inner

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_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 (3225) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3225]. Tensor sizes: [128, 3000]

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 46, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_huggingface.py", line 35, in _exec
File "videotrans\recognition\_huggingface.py", line 59, in _pipe_asr
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: The expanded size of the tensor (3225) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3225]. Tensor sizes: [128, 3000]:Traceback (most recent call last):
File "videotrans\process\_stt_pipe.py", line 97, in pipe_asr
File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\automatic_speech_recognition.py", line 266, in call

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\base.py", line 1248, in call

outputs = list(final_iterator)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\pt_utils.py", line 126, in next

item = next(self.iterator)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\pt_utils.py", line 271, in next

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\torch\utils\data\dataloader.py", line 733, in next

data = self._next_data()

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_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.05-0711\_internal\torch\utils\data\_utils\fetch.py", line 43, in fetch

return self.collate_fn(data)

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_internal\transformers\pipelines\base.py", line 173, in inner

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

File "D:\下载\下载视频\win-pyvideotrans-v4.05-0711\_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 (3225) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3225]. Tensor sizes: [128, 3000]

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: D:/下载/下载视频/视频/FC2PPV 3615385.mp4,
输出结果保存到文件夹: D:/下载/下载视频/_video_out/FC2PPV 3615385-mp4,
临时文件夹: D:/下载/下载视频/win-pyvideotrans-v4.05-0711/tmp/11672/e456160589
已选 清理已存在
未选 启用CUDA加速
未选 降噪
语音识别:Huggingface_ASR(本地内置), model_name: kotoba-tech/kotoba-whisper-v2.0, 发音语言: 日语, 断句方式:默认断句
翻译渠道:DeepSeek,原始语言:日语,目标语言:简体中文, 已选 发送完整字幕
未选 配音角色,不进行配音
字幕: 嵌入软字幕
已选 仅输出mp4
代理地址:


=
system:Windows-10-10.0.22631-SP0
version:v4.05
frozen:True
language:zh
root_dir:D:/下载/下载视频/win-pyvideotrans-v4.05-0711

1 Replies

这是 Huggingface_ASR 渠道在加载 kotoba-tech/kotoba-whisper-v2.0 模型时出现的张量尺寸不匹配错误。底层原因通常是模型的特征提取器与传入音频片段的长度不兼容(例如音频切片后被重采样产生长度偏差),导致 transformer 的 padding 操作失败。

解决方案

  1. 更换语音识别渠道:建议切换到 faster-whisper(本地内置) + large-v3 模型,它对日语的识别效果稳定且兼容性更好。
  2. 禁用 Whisper 预分割音频:在 菜单 -> 工具 -> 高级选项 -> 语音识别参数 中,取消勾选 Whisper预分割音频?。这可以避免音频切片后再传递给 Huggingface 模型时产生长度异常。
  3. 升级软件版本:当前版本为 v4.05,请下载最新的 v4.05-0711 完整包或补丁覆盖更新,此错误可能已在后续版本修复。
  4. 更换为其他日语 ASR 模型:如果坚持使用 Huggingface_ASR,可尝试改用 reazon-research/japanese-wav2vec2-large-rs35khopenai/whisper-large-v3

请查阅相关文档:

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

Dondate via PayPal

Related resource