autovc icon indicating copy to clipboard operation
autovc copied to clipboard

An error on attempt to train model

Open daaibraanies opened this issue 3 years ago • 1 comments

Getting the following error when trying to retrain model on my data and the same happens on the dataset in the repo:

Traceback (most recent call last):
  File "main.py", line 46, in <module>
    main(config)
  File "main.py", line 20, in main
    solver.train()
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/solver_encoder.py", line 89, in train
    x_identic, x_identic_psnt, code_real = self.G(x_real, emb_org, emb_org)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/model_vc.py", line 195, in forward
    codes = self.encoder(x, c_org)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/model_vc.py", line 70, in forward
    c_org = c_org.unsqueeze(-1).expand(-1,-1, x.size(2))
RuntimeError: The expanded size of the tensor (-1) isn't allowed in a leading, non-existing dimension 0

Tried to fix it changing the -1 onto c_org.shape[0] but would get the error on the following forward step:

Namespace(batch_size=2, data_dir='./spmel', dim_emb=256, dim_neck=16, dim_pre=512, freq=16, lambda_cd=1, len_crop=128, log_step=10, num_iters=1000000)
Finished loading the dataset...
Start training...
Traceback (most recent call last):
  File "main.py", line 46, in <module>
    main(config)
  File "main.py", line 20, in main
    solver.train()
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/solver_encoder.py", line 89, in train
    x_identic, x_identic_psnt, code_real = self.G(x_real, emb_org, emb_org)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/model_vc.py", line 195, in forward
    codes = self.encoder(x, c_org)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/model_vc.py", line 81, in forward
    x = F.relu(conv(x))
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/container.py", line 139, in forward
    input = module(input)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/drive/MyDrive/RND/models/vocoder/autovc/model_vc.py", line 37, in forward
    conv_signal = self.conv(signal)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 307, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 304, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size [512, 336, 5], expected input[2, 82, 128] to have 336 channels, but got 82 channels instead

Any suggestions on how to fix this?

daaibraanies avatar Jul 01 '22 11:07 daaibraanies

Please check if your input shape is compatible with the neural network's required input shape.

auspicious3000 avatar Jul 27 '22 21:07 auspicious3000