YYuX-1145 / Bert-VITS2-Integration-package

vits2 backbone with bert
https://www.bilibili.com/video/BV13p4y1d7v9
GNU Affero General Public License v3.0
332 stars 30 forks source link

RuntimeError: expand(torch.FloatTensor{[2, 1025, 278]}, size=[2, 1025]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (3),这是什么错误啊? #44

Open hwang824 opened 10 months ago

hwang824 commented 10 months ago

训练报错,错误是: RuntimeError: expand(torch.FloatTensor{[2, 1025, 278]}, size=[2, 1025]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (3)

详细的错误信息为:

ProcessRaisedException Traceback (most recent call last) File ~/autodl-tmp/Bert-VITS2-Integration-Package/train_ms.py:402, in 399 generator.train() 401 if name == "main": --> 402 main()

File ~/autodl-tmp/Bert-VITS2-Integration-Package/train_ms.py:60, in main() 58 shutil.copy('./pretrained_models/G_0.pth','./logs/OUTPUT_MODEL/G_0.pth') 59 shutil.copy('./pretrained_models/DUR_0.pth','./logs/OUTPUT_MODEL/DUR_0.pth') ---> 60 mp.spawn(run, nprocs=n_gpus, args=(n_gpus, hps,))

File ~/miniconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py:239, in spawn(fn, args, nprocs, join, daemon, start_method) 235 msg = ('This method only supports start_method=spawn (got: %s).\n' 236 'To use a different start_method use:\n\t\t' 237 ' torch.multiprocessing.start_processes(...)' % start_method) 238 warnings.warn(msg) --> 239 return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')

File ~/miniconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py:197, in start_processes(fn, args, nprocs, join, daemon, start_method) 194 return context 196 # Loop on join until it returns True or raises an exception. --> 197 while not context.join(): 198 pass

File ~/miniconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py:160, in ProcessContext.join(self, timeout) 158 msg = "\n\n-- Process %d terminated with the following error:\n" % error_index 159 msg += original_trace --> 160 raise ProcessRaisedException(msg, error_index, failed_process.pid)

ProcessRaisedException:

-- Process 0 terminated with the following error: Traceback (most recent call last): File "/root/miniconda3/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap fn(i, *args) File "/root/autodl-tmp/Bert-VITS2-Integration-Package/train_ms.py", line 193, in run train_and_evaluate(rank, epoch, hps, [net_g, net_d, net_dur_disc], [optim_g, optim_d, optim_dur_disc], [scheduler_g, scheduler_d, scheduler_dur_disc], scaler, [train_loader, eval_loader], logger, [writer, writer_eval]) File "/root/autodl-tmp/Bert-VITS2-Integration-Package/train_ms.py", line 217, in train_and_evaluate for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths, speakers, tone, language, bert) in tqdm(enumerate(train_loader)): File "/root/miniconda3/lib/python3.8/site-packages/tqdm/std.py", line 1182, in iter for obj in iterable: File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 633, in next data = self._next_data() File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1345, in _next_data return self._process_data(data) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1371, in _process_data data.reraise() File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 644, in reraise raise exception RuntimeError: Caught RuntimeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 54, in fetch return self.collate_fn(data) File "/root/autodl-tmp/Bert-VITS2-Integration-Package/data_utils.py", line 212, in call spec_padded[i, :, :spec.size(1)] = spec RuntimeError: expand(torch.FloatTensor{[2, 1025, 278]}, size=[2, 1025]): the number of sizes provided (2) must be greater or equal to the number of dimensions in the tensor (3)

ADKcodeXD commented 8 months ago

同问 +1

ADKcodeXD commented 8 months ago

https://github.com/YYuX-1145/Bert-VITS2-Integration-package/issues/42#issuecomment-1780509004

42

感觉是这个,但是实测2s可能是不太行的,尽可能每一段音频在3s以上。