songyouwei / ABSA-PyTorch

Aspect Based Sentiment Analysis, PyTorch Implementations. 基于方面的情感分析,使用PyTorch实现。
MIT License
2.03k stars 528 forks source link

RAM model: RuntimeError: Expected object of scalar type Float but got scalar type Long #63

Open Nivek92 opened 5 years ago

Nivek92 commented 5 years ago

When I run

python3 train.py --model_name ram --dataset restaurant --learning_rate 1e-3 --num_epoch 200

I get

RuntimeError: Expected object of scalar type Float but got scalar type Long for sequence element 1 in sequence argument at position #1 'tensors'

nghidinhit commented 5 years ago

In locationed_memory() function, you should add the following line: u = u.type(torch.FloatTensor).to(self.opt.device)