Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert x.size()[1] == self.in_feats AssertionError #156

Open
zabir-nabil opened this issue Aug 2, 2022 · 1 comment
Open

assert x.size()[1] == self.in_feats AssertionError #156

zabir-nabil opened this issue Aug 2, 2022 · 1 comment

Comments

@zabir-nabil
Copy link

Hi, thanks for sharing this amazing repository.

When using aamsoftmax, I am getting this error for all of the models.

Save path: exps/nist_old_bang_youtube_aamsoft_rawnet
Embedding size is 256, encoder SAP.
Initialised AAMSoftmax margin 0.100 scale 30.000
Initialised Adam optimizer
Initialised step LR scheduler
torch.Size([100, 2, 256]) 256
----------------------
Traceback (most recent call last):
  File "./trainSpeakerNet.py", line 304, in <module>
    main()
  File "./trainSpeakerNet.py", line 300, in main
    main_worker(0, None, args)
  File "./trainSpeakerNet.py", line 238, in main_worker
    loss, traineer = trainer.train_network(train_loader, verbose=(args.gpu == 0));
  File "/triplet_sre/voxceleb_trainer/SpeakerNet.py", line 111, in train_network
    nloss, prec1 = self.__model__(data, label)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/triplet_sre/voxceleb_trainer/SpeakerNet.py", line 23, in forward
    return self.module(x, label)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/triplet_sre/voxceleb_trainer/SpeakerNet.py", line 51, in forward
    nloss, prec1 = self.__L__.forward(outp,label)
  File "/triplet_sre/voxceleb_trainer/loss/aamsoftmax.py", line 39, in forward
    assert x.size()[1] == self.in_feats
AssertionError

It seems, x has this shape torch.Size([100, 2, 256]), now x.size()[1] is 2 and not 256, so it throws this error. How can I fix this error?

@Jungjee
Copy link
Collaborator

Jungjee commented Aug 9, 2022

Hi @zabir-nabil.
May I first ask for the configuration you used?

  • I'm suspecting that you may have set nPerSpeaker to 2 whereas you should set to 1 for aamsoftmax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants