allenai / commonsense-kg-completion

MIT License
107 stars 16 forks source link

an Error #2

Closed Diison closed 3 years ago

Diison commented 4 years ago

Thank you for your great work, but when I try to train the model using the command "python -u src/run_kbc_subgraph.py --dataset conceptnet --evaluate-every 10 --n-layers 2 --graph-batch-size 60000 --sim_relations --bert_concat".

I got an error as follow:

Traceback (most recent call last): File "src/run_kbc_subgraph.py", line 532, in main(args) File "src/run_kbc_subgraph.py", line 349, in main loss = model.get_score(e1, rel, target, graph_embeddings) File "/home/s2020017/work/commonsenseKBC/src/model.py", line 155, in get_score reg_loss = self.regularization_loss(embedding) File "/home/s2020017/work/commonsenseKBC/src/model.py", line 134, in regularization_loss dec_weight = self.decoder.module.w_relation.weight.pow(2) File "/home/s2020017/Anaconda_3.7/envs/commonsenseKBC/lib/python3.6/site-packages/torch/nn/modules/module.py", line 518, in getattr type(self).name, name)) AttributeError: 'ConvTransE' object has no attribute 'module'

How can I fix it? Thank you so much!!

woocoder commented 4 years ago

Thank you for your great work, but when I try to train the model using the command "python -u src/run_kbc_subgraph.py --dataset conceptnet --evaluate-every 10 --n-layers 2 --graph-batch-size 60000 --sim_relations --bert_concat".

I got an error as follow:

Traceback (most recent call last): File "src/run_kbc_subgraph.py", line 532, in main(args) File "src/run_kbc_subgraph.py", line 349, in main loss = model.get_score(e1, rel, target, graph_embeddings) File "/home/s2020017/work/commonsenseKBC/src/model.py", line 155, in get_score reg_loss = self.regularization_loss(embedding) File "/home/s2020017/work/commonsenseKBC/src/model.py", line 134, in regularization_loss dec_weight = self.decoder.module.w_relation.weight.pow(2) File "/home/s2020017/Anaconda_3.7/envs/commonsenseKBC/lib/python3.6/site-packages/torch/nn/modules/module.py", line 518, in getattr type(self).name, name)) AttributeError: 'ConvTransE' object has no attribute 'module'

How can I fix it? Thank you so much!!

You can use the ' dec_weight = self.decoder.w_relation.weight.pow(2)' instead of ' dec_weight = self.decoder.module.w_relation.weight.pow(2)'