Skip to content

RuntimeError: expected scalar type Long but found Double #5

@RyanMills19

Description

@RyanMills19

I'm using a dataset I scraped but same structure comments with rating 0-10, using the same commands as provided except group_labels=0

Traceback (most recent call last):
  File "train.py", line 415, in <module>
    run(args)
  File "train.py", line 297, in run
    training_loss, training_accuracy, train_f1 = train(model,
  File "train.py", line 50, in train
    loss = criterion(predictions, labels)
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 915, in forward
    return F.cross_entropy(input, target, weight=self.weight,
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\functional.py", line 2021, in cross_entropy
    return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\functional.py", line 1838, in nll_loss
    ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: expected scalar type Long but found Double

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