tbepler / protein-sequence-embedding-iclr2019

Source code for "Learning protein sequence embeddings using information from structure" - ICLR 2019
Other
253 stars 75 forks source link

Runtime Error in eval_secstr.py #20

Closed Chenwf1025 closed 3 years ago

Chenwf1025 commented 3 years ago

python .\eval_secstr.py 1-mer split epoch loss perplexity accuracy Traceback (most recent call last): File ".\eval_secstr.py", line 427, in main() File ".\eval_secstr.py", line 361, in main potentials = model(x).view(x.size(0), -1) File "D:\Software\Anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "D:\Software\Anaconda\lib\site-packages\torch\nn\modules\sparse.py", line 126, in forward self.norm_type, self.scale_grad_by_freq, self.sparse) File "D:\Software\Anaconda\lib\site-packages\torch\nn\functional.py", line 1814, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse) RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.IntTensor instead (while checking arguments for embedding)

OS: Windows10, python 3.7.4, pytorch 1.6.0

Chenwf1025 commented 3 years ago

Ok... Just add x=x.long() befor potentials = model(x).view(x.size(0), -1) , and y=y.long() after y = I[y]would fix the problem.