DreamInvoker / GAIN

Source code for EMNLP 2020 paper: Double Graph Based Reasoning for Document-level Relation Extraction
MIT License
142 stars 30 forks source link

dgl_cu111-0.7.1 I use this dgl version and get train errors #34

Open Juliaququ opened 2 years ago

Juliaququ commented 2 years ago

Traceback (most recent call last): File "train.py", line 231, in train(opt) File "train.py", line 125, in train predictions = model(words=d['context_idxs'], File "/home/anaconda3/envs/qusiyu/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/data/qusiyu/GAIN-master/code/models/GAIN.py", line 304, in forward encoder_outputs = torch.cat([encoder_outputs, self.entity_type_emb(params['entity_type'])], dim=-1) TypeError: expected Tensor as element 0 in argument 0, but got str

LawsonAbs commented 2 years ago

Traceback (most recent call last): File "train.py", line 231, in train(opt) File "train.py", line 125, in train predictions = model(words=d['context_idxs'], File "/home/anaconda3/envs/qusiyu/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/data/qusiyu/GAIN-master/code/models/GAIN.py", line 304, in forward encoder_outputs = torch.cat([encoder_outputs, self.entity_type_emb(params['entity_type'])], dim=-1) TypeError: expected Tensor as element 0 in argument 0, but got str

如果使用了较高的cuda和dgl,各个组件的版本都要升级一下吧?你这可能是transformer的原因?

frleez commented 1 year ago

Traceback (most recent call last): File "train.py", line 231, in train(opt) File "train.py", line 125, in train predictions = model(words=d['context_idxs'], File "/home/anaconda3/envs/qusiyu/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/data/qusiyu/GAIN-master/code/models/GAIN.py", line 304, in forward encoder_outputs = torch.cat([encoder_outputs, self.entity_type_emb(params['entity_type'])], dim=-1) TypeError: expected Tensor as element 0 in argument 0, but got str

Hi! Did you solve it? I'm facing the same problem