#6849 cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is

120.244.**9 Posted at: 2 hours ago

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 "E:\A4.9\_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 702, in create_voice_clone_prompt

ref_text = add_punctuation(ref_text)

File "E:\A4.9\_internal\transformers\models\higgs_audio_v2_tokenizer\modeling_higgs_audio_v2_tokenizer.py", line 543, in encode

e_semantic_input = self._extract_semantic_features(input_values).detach()

File "E:\A4.9\_internal\transformers\models\higgs_audio_v2_tokenizer\modeling_higgs_audio_v2_tokenizer.py", line 491, in _extract
......
cified 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 "E:\A4.9\_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 702, in create_voice_clone_prompt

ref_text = add_punctuation(ref_text)

File "E:\A4.9\_internal\transformers\models\higgs_audio_v2_tokenizer\modeling_higgs_audio_v2_tokenizer.py", line 543, in encode

e_semantic_input = self._extract_semantic_features(input_values).detach()

File "E:\A4.9\_internal\transformers\models\higgs_audio_v2_tokenizer\modeling_higgs_audio_v2_tokenizer.py", line 491, in _extract_semantic_features

input_values = torchaudio.functional.resample(

File "E:\A4.9\_internal\torchaudio\functional\functional.py", line 1530, in resample

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

File "E:\A4.9\_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]当前工作模式: 翻译视频 单视频模式
原始输入文件名: E:/videoplayback_(Vocals).wav,
输出结果保存到文件夹: E:/_video_out/videoplayback_(Vocals)-wav,
临时文件夹: E:/A4.9/tmp/38800/2582544d82
未选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:Qwen-ASR(内置), 1.7B, 发音语言: 英语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:OmniVoice(内置), 角色:clone, 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 未选 音频加速, 未选 视频慢速
未选 移除字幕间空隙, 已选 强制对齐字幕和声音
字幕: 嵌入软字幕


=
system:Windows-10-10.0.26200-SP0
version:v4.09
frozen:True
language:zh
root_dir:E:/A4.9

1 Replies

#1 DeepSeek reply at 2 hours ago

这是 OmniVoice 内置渠道在语音克隆(clone 角色)模式下,从原始音频截取的参考音频为空 导致的错误。参考音频必须是真实存在、时长合理的音频数据,如果截取到 0 采样点或纯静音,就会在 torchaudio.resample 时触发 cannot reshape tensor of 0 elements

解决方案

1. 验证原始音频文件
使用播放器打开 E:/videoplayback_(Vocals).wav,确认文件确实有声音且时长正常。如果该文件是之前从其他工具分离出的 (Vocals),很可能存在采样率异常、32-bit float 编码或文件头损坏问题,导致软件读取不到有效数据。
可在命令提示符中运行以下命令查看音频信息:

ffmpeg -i "E:/videoplayback_(Vocals).wav"

若信息异常,请用 ffmpeg 将它转换为标准格式:

ffmpeg -i "E:/videoplayback_(Vocals).wav" -ar 16000 -ac 1 -sample_fmt s16 "E:/voice_16k.wav"

然后重新导入转换后的文件。

2. 重命名文件,避免特殊符号
文件名中的括号 (Vocals) 和多个特殊字符,有可能会导致底层音频处理工具解析异常。请将文件重命名为简短的英文字母,例如 vo.wav,再进行处理。

3. 在高级选项中强制控制参考音频时长
语音克隆要求参考音频长度控制在 3-10 秒,否则极易失败。请进入:
菜单 -> 工具 -> 高级选项 -> 语音识别参数

  • 设置 最长语音持续(秒)6-10
  • 设置 最短语音持续(毫秒)3000-4000
  • 勾选 合并过短字幕到邻近
  • 勾选 Whisper预分割音频?

4. 升级到最新版本 v4.11
你当前使用的是 v4.09,较旧版本存在已知的内部 bug。请下载最新完整包或补丁包覆盖更新,升级后再试。

5. 若问题仍然存在
请将 logs/ 目录下最新日志文件(logs/日期.log)的底部约 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