我正在使用VITS培训,但在手电筒填充时出现以下异常:
AssertionError: 4D tensors expect 4 values for padding
虚拟仪器系统链接:https://github.com/jaywalnut310/vits
VITS日语链接:https://github.com/innnky/vits-japanese
torch的版本为1.6.0,来自requirements.txt
命令:(test.json与VITS-Japanese中的nan.json相同)
python train.py -c config/test.json -m test
错误:
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/multiprocessing/spawn.py", line 20, in _wrap
fn(i, *args)
File "/content/vits-japanese/train.py", line 117, in run
train_and_evaluate(rank, epoch, hps, [net_g, net_d], [optim_g, optim_d], [scheduler_g, scheduler_d], scaler, [train_loader, eval_loader], logger, [writer, writer_eval])
File "/content/vits-japanese/train.py", line 137, in train_and_evaluate
for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths) in enumerate(train_loader):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 363, in __next__
data = self._next_data()
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 989, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 1014, in _process_data
data.reraise()
File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 395, in reraise
raise self.exc_type(msg)
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/vits-japanese/data_utils.py", line 97, in __getitem__
return self.get_audio_text_pair(self.audiopaths_and_text[index])
File "/content/vits-japanese/data_utils.py", line 62, in get_audio_text_pair
spec, wav = self.get_audio(audiopath)
File "/content/vits-japanese/data_utils.py", line 81, in get_audio
center=False)
File "/content/vits-japanese/mel_processing.py", line 71, in spectrogram_torch
y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect')
File "/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py", line 3567, in _pad
assert len(pad) == 4, '4D tensors expect 4 values for padding'
AssertionError: 4D tensors expect 4 values for padding
我已经跟踪了输入的大小。
data_utils. py. get_audio()中的原始音频:
torch.Size([69506, 2])
data_utils. py. get_audio()中解压缩(0)后的音频规范:
torch.Size([1, 69506, 2])
y.在熔化_处理. py.谱图_ Torch ()中解压缩(1):
torch.Size([1, 1, 69506, 2])
填充大小与默认配置相同((1024 - 256)/2):
(384,384)
我没有修改VITS代码,所以Tensor大小和填充大小应该正确。
或者我需要对输入的wav文件做些什么吗?
1条答案
按热度按时间zphenhs41#
问题出在输入wav文件上。
应该是单声道的,不是双耳的。
我重新采样了wav,效果很好。