INK-USC / RE-Net

Recurrent Event Network: Autoregressive Structure Inference over Temporal Knowledge Graphs (EMNLP 2020)
http://inklab.usc.edu/renet/
436 stars 95 forks source link

RuntimeError: tensors used as indices must be long or byte tensors #10

Closed binjiaqm closed 5 years ago

binjiaqm commented 5 years ago

Traceback (most recent call last): File "train.py", line 223, in train(args) File "train.py", line 126, in train loss = model.get_loss(batch_data, s_hist, o_hist, None) File "X:\GitRepo\RE-Net\model.py", line 131, in getloss loss, , , , _ = self.forward(triplets, s_hist, o_hist, graph_dict) File "X:\GitRepo\RE-Net\model.py", line 101, in forward self.dropout(torch.cat((self.ent_embeds[s[s_idx]], s_h, self.rel_embeds[:self.num_rels][r[s_idx]]), dim=1))) RuntimeError: tensors used as indices must be long or byte tensors

Any ideas?

woojeongjin commented 5 years ago

In my environment, I don't have any problems. Could you let me know your python, pytorch versions?

binjiaqm commented 5 years ago

Sure. Python 3.6.8. Pytorch 1.0.1. Windows 10. May I know the versions you use?

shanzhenren commented 5 years ago

@woojeongjin maybe share your env setup?

woojeongjin commented 5 years ago

Sorry for the late reply. My version is Python 3.7.1 and Pytorch 1.1.0. And the other environment, I use Python 3.6.7 and Pytorch 0.4.1. My codes work on both envs.

martozzz commented 5 years ago

Hi all, I got exactly the same issue as @binjiaqm does. My env is Python 3.6.7 and Pytorch 0.4.1, which is the same as @woojeongjin 's. Can you give any suggestions? Thanks.

Bryan2Chow commented 4 years ago

Hi, all. @binjiaqm @woojeongjin @shanzhenren @MartinZZZ I got exactly the same issue in model.py line 90 details in #29 Could you please tell me how to fix it? Thanks a lot!