IBM / pytorch-seq2seq

An open source framework for seq2seq models in PyTorch.
https://ibm.github.io/pytorch-seq2seq/public/index.html
Apache License 2.0
1.5k stars 376 forks source link

Cuda.LongTensor instead of LongTensor on GPU #156

Closed ShilinHe closed 6 years ago

ShilinHe commented 6 years ago

I found this bug when running the basic script, example/sample.py:

return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse) RuntimeError: Expected object of type torch.cuda.LongTensor but found type torch.LongTensor for argument #3 'index'

It seems to be a wrong type of tensor on GPU.

pskrunner14 commented 6 years ago

@ShilinHe can you provide the complete log? Seems like the tensor is'nt being assigned to cuda.

cailurus commented 6 years ago

same

pskrunner14 commented 6 years ago

@ShilinHe this has been fixed in #161.

ShilinHe commented 6 years ago

So sorry for the late reply, Thanks for your work!

DavidLKing commented 6 years ago

Heads up, I'm getting the same errors after a fresh clone. I've been manually adding if torch.cuda.is_available(): VARIABLE.cuda() entries to get around it temporarily.