facebookresearch / SentEval

A python tool for evaluating the quality of sentence embeddings.
Other
2.09k stars 309 forks source link

bow.py RuntimeError: tried to construct a tensor from a int sequence, but found an item of type numpy.int64 at index (0) #9

Closed sojvai closed 7 years ago

sojvai commented 7 years ago

File "../senteval/tools/relatedness.py", line 110, in trainepoch idx = torch.cuda.LongTensor(permutation[i:i + self.batch_size]) RuntimeError: tried to construct a tensor from a int sequence, but found an item of type numpy.int64 at index (0)

converted numpy arrary to python list seemed working

idx = torch.cuda.LongTensor(permutation[i:i + self.batch_size].tolist())

sojvai commented 7 years ago

removing cuda also works idx = torch.LongTensor(permutation[i:i + self.batch_size])