DeepGraphLearning/KnowledgeGraphEmbedding

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

jweihe opened this issue · 3 comments

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

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

Hi, Junwei,

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