Hi, @hengruo
When I trained the model, I got an issue below:
File "/XXX/QANet-pytorch-master/models.py", line 33, in init
self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos, freqs), phases)), requires_grad=False)
RuntimeError: Expected object of type torch.LongTensor but found type torch.FloatTensor for argument #2 'other'
Then I modified the code so that I can run it correctly:
self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos.float(), freqs), phases)), requires_grad=False)
I don't know why only I have got the issue.
Thank you!
Hi, @hengruo When I trained the model, I got an issue below:
File "/XXX/QANet-pytorch-master/models.py", line 33, in init self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos, freqs), phases)), requires_grad=False) RuntimeError: Expected object of type torch.LongTensor but found type torch.FloatTensor for argument #2 'other'
Then I modified the code so that I can run it correctly: self.pos_encoding = nn.Parameter(torch.sin(torch.add(torch.mul(pos.float(), freqs), phases)), requires_grad=False)
I don't know why only I have got the issue. Thank you!