auspicious3000 / autovc

AutoVC: Zero-Shot Voice Style Transfer with Only Autoencoder Loss
https://arxiv.org/abs/1905.05879
MIT License
976 stars 207 forks source link

Error(s) in loading state_dict for Generator: size mismatch for encoder.lstm.weight_ih_l0: copying a param with shape torch.Size([64, 512]) from checkpoint, the shape in current model is torch.Size([128, 512]) #77

Closed ghost closed 3 years ago

ghost commented 3 years ago

Helo, After trainig I try load model. I did not change any parameter.

Error(s) in loading state_dict for Generator:
    size mismatch for encoder.lstm.weight_ih_l0: copying a param with shape torch.Size([64, 512]) from checkpoint, the shape in current model is torch.Size([128, 512])

What make wrong?

ghost commented 3 years ago

I had to change the code to: G = Generator(**16**,256,512,32).eval().to(device) # (dim_neck, dim_emb, dim_pre, freq): Instead of: G = Generator(**32**,256,512,32).eval().to(device) # (dim_neck, dim_emb, dim_pre, freq):

JohnHerry commented 3 years ago

The same problem. What is the final solution?

JohnHerry commented 3 years ago

I am trying to retrain with python main.py --dim_neck=32 --freq=32 ; Maybe that is the same inputs shape with pretrained model.

auspicious3000 commented 3 years ago

Yes. There might be some parameter discrepancies after the 2nd major repo update.

ynalcakan commented 11 months ago

So what is the solution? Will you make a correction on the repo? The code is still not reproducible with this current version.

auspicious3000 commented 11 months ago

@ynalcakan To load a Pytorch checkpoint, the hyperparameters have to match. You need to set the corresponding hyperparameters before loading a Pytorch checkpoint. For example, you can try setting --dim_neck=32 --freq=32