jaywalnut310 / vits

VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech
https://jaywalnut310.github.io/vits-demo/index.html
MIT License
6.91k stars 1.27k forks source link

torch.nn.modules.module.ModuleAttributeError: 'SynthesizerTrn' object has no attribute 'emb_g' 【anybody help me,please!】 #96

Open lunar333 opened 2 years ago

lunar333 commented 2 years ago

when I am running the train_ms.py , it has some errows as follow:

Traceback (most recent call last): File "train_ms.py", line 296, in main() File "train_ms.py", line 50, in main WARNING:vctk_base:/data/private/sxyl3800/workspace/emotional-vits-main is not a git repository, therefore hash value comparison will be ignored. Traceback (most recent call last): File "train_ms.py", line 296, in main() File "train_ms.py", line 50, in main mp.spawn(run, nprocs=n_gpus, args=(n_gpus, hps,)) File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 200, in spawn return start_processes(fn, args, nprocs, join, daemon, start_method='spawn') File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 158, in start_processes while not context.join(): File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 119, in join raise Exception(msg) Exception:

-- Process 2 terminated with the following error: Traceback (most recent call last): File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/multiprocessing/spawn.py", line 20, in _wrap fn(i, args) File "/data/private/sxyl3800/workspace/emotional-vits-main/train_ms.py", line 120, in run train_and_evaluate(rank, epoch, hps, [net_g, net_d], [optim_g, optim_d], [scheduler_g, scheduler_d], scaler, [train_loader, None], None, None) File "/data/private/sxyl3800/workspace/emotional-vits-main/train_ms.py", line 147, in train_and_evaluate (z, z_p, m_p, logs_p, m_q, logs_q) = net_g(x, x_lengths, spec, spec_lengths, speakers, emo) File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(input, kwargs) File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 511, in forward output = self.module(*inputs[0], *kwargs[0]) File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(input, kwargs) File "/data/private/sxyl3800/workspace/emotional-vits-main/models.py", line 466, in forward g = self.emb_g(sid).unsqueeze(-1) # [b, h, 1] File "/home/sxyl3800/.conda/envs/pytorch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 772, in getattr type(self).name, name)) torch.nn.modules.module.ModuleAttributeError: 'SynthesizerTrn' object has no attribute 'emb_g'

anybody help me,please!

junjun3518 commented 1 year ago

Hello! I am not sure about your modified module, but it seems that it is caused by your forward arg speakers while you are using single speaker dataset https://github.com/jaywalnut310/vits/blob/2e561ba58618d021b5b8323d3765880f7e0ecfdb/models.py#L456 Check this line and remove speaker argument if you are using single speaker dataset