You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to train the neural network model for Task2A (i.e., emoji prediction in English), from SemEval2018. However, when I run the file neural_experiment.py, located in model/task2/, I get the following error message:
File "./model/task2/neural_experiment.py", line 52, in <module>
model_training(trainer, model_config["epochs"])
File "../..\utils\train.py", line 387, in model_training
trainer.train()
File "../..\logger\training.py", line 520, in train
self.train_loader(self.loaders["train"])
File "../..\logger\training.py", line 488, in train_loader
sample_batched)
File "../..\utils\train.py", line 143, in pipeline
outputs, attentions = nn_model(inputs, lengths)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\modules\module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "../..\modules\nn\models.py", line 203, in forward
representations, attentions = self.feature_extractor(x, lengths)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\modules\module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "../..\modules\nn\models.py", line 140, in forward
embeddings = self.embedding(x)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\modules\module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "../..\modules\nn\modules.py", line 148, in forward
embeddings = self.embedding(x)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\modules\module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\modules\sparse.py", line 118, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "D:\WinPython\python-3.7.2.amd64\lib\site-packages\torch\nn\functional.py", line 1454, 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)
Do you have any idea what I should do next?
The text was updated successfully, but these errors were encountered:
First of all, what version of pytorch do you have? The project was developed with pytorch version 0.4.0.
Judging by the error message, the problem seems to be that the list of word ids has the wrong data type. Try casting the inputs to long type in this line, ike this:
I am trying to train the neural network model for Task2A (i.e., emoji prediction in English), from SemEval2018. However, when I run the file neural_experiment.py, located in model/task2/, I get the following error message:
Do you have any idea what I should do next?
The text was updated successfully, but these errors were encountered: