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

141.227**6 Posted at: 1 hour ago

语音识别阶段出错[Huggingface_ASR(内置)] The expanded size of the tensor (3104) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3104]. Tensor sizes: [128, 3000]:Traceback (most recent call last):
File "videotrans\process\stt_pipe.py", line 65, 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
......
deotrans-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

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 (3104) must match the existing size (3000) at non-singleton dimension 1. Target sizes: [128, 3104]. Tensor sizes: [128, 3000]
[SpeechToText]语音转录: self.out_format='srt',self.copysrt_rawvideo=True,self.spk_insert=False
[TaskCfgSTT]
原始输入文件名: C:/Users/1/Desktop/BOBB-442J.mp4,
输出结果保存到文件夹: D:/win-pyvideotrans-v4.11/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.11/tmp/1648/2adbc3d2c8
已启用CUDA加速
未选 降噪
语音识别:Huggingface_ASR(内置), kotoba-tech/kotoba-whisper-v2.0 断句方式:默认断句
发音语言:ja
未选 降噪


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

5 Replies

#1 DeepSeek reply at 1 hour ago

这是 kotoba-tech/kotoba-whisper-v2.0 模型与当前 transformers 库的兼容性问题,表现为批量音频特征 padding 时维度不匹配(3104 vs 3000)。

建议按以下顺序处理:

  1. 更换语音识别模型:在 Huggingface_ASR(内置) 渠道中,将模型从 kotoba-tech/kotoba-whisper-v2.0 改为 openai/whisper-large-v3(对所有语言通用)或 reazon-research/japanese-wav2vec2-large-rs35kh(日语)。该模型已知存在此类 tensor 维度不匹配的潜在问题。
  2. 改用其他日语识别渠道:推荐使用 openai-whisper(内置) + large-v3 模型,或 parakeet日语(内置)。这两个渠道对日语的识别效果均较好,且不存在此报错。
  3. 检查模型文件是否完整:如果确定要使用该模型,请删除 软件目录/models/models--kotoba-tech--kotoba-whisper-v2.0 文件夹,重新在软件中触发自动下载,以排除模型损坏的可能性。
  4. 确认显存充足:如果已启用 CUDA 加速,建议在 高级选项-语音识别参数 中,将 计算数据类型 设为 float16,并将 beam_size 调为 1,降低内存占用。

如果以上操作后问题仍然存在,请提供 logs/ 目录下最新日志文件的完整报错信息以便进一步分析。

请查阅相关文档:

#2 141.227**6 reply at 59 minutes ago

怎么恢复高级设置中的默认,我想全部退回默认设置 4.12版本

#3 DeepSeek reply at 59 minutes ago

软件无内置的“一键恢复默认”按钮。要恢复全部默认设置,请关闭软件,进入软件根目录下的 videotrans 文件夹,删除以下配置文件:cfg.json(保存高级选项及系统设置)和 params.json(保存API密钥和偏好设置),建议同时删除 codec.jsonass.json。重新启动 sp.exe 后,软件会自动生成全新的默认配置。如仅需恢复高级选项,只删除 cfg.json 即可。删除前建议先备份,因所有自定义项都会丢失。

#4 141.227**6 reply at 54 minutes ago

全都是默认下载的,但是一直就报错

#5 DeepSeek reply at 54 minutes ago

这不是您的设置或模型下载错误。kotoba-tech/kotoba-whisper-v2.0 这个默认模型本身存在与当前 transformers 库的兼容性问题,导致音频特征 padding 时维度不匹配(3104 vs 3000)。即使恢复全部默认设置,只要仍使用该模型,报错就会持续出现。

请直接更换语音识别模型即可解决:

  1. 在主界面语音识别渠道中,仍选择 Huggingface_ASR(内置),将模型改为 openai/whisper-large-v3(支持日语,质量稳定)。
  2. 或改用 parakeet日语(内置)(专为日语优化)。
  3. 也可整体切换为 openai-whisper(内置) 渠道,模型选 large-v3。

如果更换后仍报错,请确认模型下载完整(删除 models/models--kotoba-tech--kotoba-whisper-v2.0 文件夹后重新触发下载),并检查 CUDA 显存是否充足。若问题依旧,请提供 logs/ 目录下最新日志的完整报错信息。

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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