DeepGraphLearning / KnowledgeGraphEmbedding

MIT License
1.24k stars 264 forks source link

RuntimeError: The size of tensor a (2000) must match the size of tensor b (1000) at non-singleton dimension 2 #40

Closed jweihe closed 3 years ago

jweihe commented 3 years ago

I am using the following parameters to train Transe to report an error. The error message is in the title。 --do_train --cuda --do_valid --do_test --data_path D:\KnowledgeGraphEmbedding\data\wn18rr --model TransE -n 256 -b 1 -d 1000 -g 24.0 -a 1.0 -adv -lr 0.001 --max_steps 1500 -save models/TransE_wn18rr_0 --test_batch_size 1 -de

The detailed error information is Traceback (most recent call last): File "D:/KnowledgeGraphEmbedding/codes/run.py", line 364, in main(parse_args()) File "D:/KnowledgeGraphEmbedding/codes/run.py", line 308, in main log = kge_model.train_step(kge_model, optimizer, train_iterator, args) File "D:\KnowledgeGraphEmbedding\codes\model.py", line 267, in train_step negative_score = model((positive_sample, negative_sample), mode=mode) File "E:\anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, **kwargs) File "D:\KnowledgeGraphEmbedding\codes\model.py", line 159, in forward score = model_func[self.model_name](head, relation, tail, mode) File "D:\KnowledgeGraphEmbedding\codes\model.py", line 169, in TransE score = (head + relation) - tail RuntimeError: The size of tensor a (2000) must match the size of tensor b (1000) at non-singleton dimension 2

jweihe commented 3 years ago

I hope someone can help me because I'm in a hurry

Edward-Sun commented 3 years ago

Hi, Junwei,

You should not use "-de" arg, which means "double embedding size".

jweihe commented 3 years ago

thanks a lot

------------------ 原始邮件 ------------------ 发件人: "Zhiqing Sun"<notifications@github.com>; 发送时间: 2020年10月9日(星期五) 上午7:53 收件人: "DeepGraphLearning/KnowledgeGraphEmbedding"<KnowledgeGraphEmbedding@noreply.github.com>; 抄送: "莫道"<3326572402@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [DeepGraphLearning/KnowledgeGraphEmbedding] RuntimeError: The size of tensor a (2000) must match the size of tensor b (1000) at non-singleton dimension 2 (#40)

Hi, Junwei,

You should not use "-de" arg, which means "double embedding size".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.