Skip to content

Error when training the model for Task2A #8

@armandrotaru

Description

@armandrotaru

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions