rahuln / lm-bio-kgc

Using pretrained language models for biomedical knowledge graph completion.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dimension error when training dkrl model.

moonliii opened this issue · comments

commented

Hi, thanks for your quick response! When I was running python script/training/repodb/dkrl_grid.py 0 I encountered another issue:
margin_ranking_loss : All input tensors should have same dimension but got sizes: input1: torch.Size([64]), input2: torch.Size([64]), target: torch.Size([64, 1])

That's strange, when I run the same command I don't get that error - the training and evaluation seems to run fine. Could you provide more details, such as where in the code the error is coming from?

commented

In src/lm/run.py, row 678, ranking_lossfn(pos, neg, batch.labels[:npos]).

I see, I'm not getting the same error at that line in the code even though all my input tensors are the same sizes (calling the loss function works fine). I would suggest taking a look at the version of torch that you have installed (and maybe other packages as well) and making sure it matches the one in environment.yml, that may be causing the issue.