#6752 配音阶段出错 [OmniVoice(内置)] cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1

112.120.**7 Posted at: 1 hour ago

配音阶段出错 [OmniVoice(内置)] cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous,Traceback (most recent call last):
File "videotrans\process\omnivoice_tts.py", line 74, in omnivoice_fun
File "D:\Documents\win-pyvideotrans\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "omnivoice\models\omnivoice.py", line 567, in generate

voice_clone_prompt=voice_clone_prompt,

File "omnivoice\models\omnivoice.py", line 959, in _preprocess_all
File "omnivoice\models\omnivoice.py", line 638, in create_voice_clone_prompt

if waveform.shape[0] > 1:

File "omnivoice\utils\audio.py", line 84, in load_audio

data = torchaudio.functional.resample(

File "D:\Documents\win-pyvideotrans\_internal\torchaudio\functional\functional.py", line 1530, in resample

resampled = _apply_sinc_resample_kernel(waveform, orig_freq, new_freq, gcd, kernel, width)

......
.configure.excepts.VideoTransError: cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous,Traceback (most recent call last):
File "videotrans\process\omnivoice_tts.py", line 74, in omnivoice_fun
File "D:\Documents\win-pyvideotrans\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "omnivoice\models\omnivoice.py", line 567, in generate

voice_clone_prompt=voice_clone_prompt,

File "omnivoice\models\omnivoice.py", line 959, in _preprocess_all
File "omnivoice\models\omnivoice.py", line 638, in create_voice_clone_prompt

if waveform.shape[0] > 1:

File "omnivoice\utils\audio.py", line 84, in load_audio

data = torchaudio.functional.resample(

File "D:\Documents\win-pyvideotrans\_internal\torchaudio\functional\functional.py", line 1530, in resample

resampled = _apply_sinc_resample_kernel(waveform, orig_freq, new_freq, gcd, kernel, width)

File "D:\Documents\win-pyvideotrans\_internal\torchaudio\functional\functional.py", line 1462, in _apply_sinc_resample_kernel

waveform = waveform.view(-1, shape[-1])

RuntimeError: cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous
cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 批量翻译模式
原始输入文件名: D:/Documents/Desktop/AAAAAA/01.mp4,
输出结果保存到文件夹: D:/Documents/Desktop/AAAAAA/_video_out/01-mp4,
临时文件夹: D:/Documents/win-pyvideotrans/tmp/25404/67b48003a0
未选 清理已存在
已启用CUDA加速
已选 降噪
已选 识别说话人,最大说话人数量不限制
语音识别:faster-whisper(内置), large-v3, 发音语言: 简体中文, 断句方式:默认断句
翻译渠道:DeepSeek,原始语言:简体中文,目标语言:英语, 已选 发送完整字幕
配音渠道:OmniVoice(内置), 角色:clone, 配音语言:英语, 未选 二次语音识别
音量:+100%, 语速:+10%, 已选 音频加速, 已选 视频慢速
字幕: 嵌入硬字幕
已选 分离人声与背景声, 已选 重新嵌入背景声, 背景音量1.0, 背景声音时长 短于 视频时长时: 拉长(降速播放),存在分离后的纯净人声文件,存在分离后的背景声音文件


=
system:Windows-10-10.0.26200-SP0
version:v4.09
frozen:True
language:zh
root_dir:D:/Documents/win-pyvideotrans

1 Replies

#1 DeepSeek reply at 1 hour ago

该错误是 OmniVoice 在“克隆原音色”(角色为 clone)时,按字幕时间轴从原视频/人声中截取的参考音频为空(0 个采样点),重采样时形状无效导致。

请依次尝试以下操作:

  1. 暂时取消勾选「分离人声与背景声」和「降噪」再执行。分离后的人声文件在某一段可能为空或全静音,导致 clone 拿不到有效参考音频。
  2. 在「菜单 → 工具 → 高级选项 → 语音识别参数」中做如下设置,保证每条字幕对应的参考音频约为 3-10 秒:

    • 最长语音持续(秒):6~10
    • 最短语音持续(毫秒):3000~4000
    • 勾选「合并过短字幕到邻近」
  3. 使用 clone 角色时请保持「默认断句」,不要开启「LLM重新断句」(你当前已是默认断句,保持即可)。
  4. 如果上述调整后仍复现,请提供软件安装目录下 logs/ 文件夹中最新日志文件底部约 30 行内容,同时说明软件左上角版本号,以便进一步定位。

请查阅相关文档:

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