rahuln / lm-bio-kgc

Using pretrained language models for biomedical knowledge graph completion.
46 stars 7 forks source link

Suggested small fix when loading msi model #2

Closed giuliacassara closed 3 years ago

giuliacassara commented 3 years ago

Hi,

I was following your readme, but when I load the model for msi I get the following error:

Traceback (most recent call last): File "test.py", line 17, in <module> model.load_state_dict(state_dict) File "/home/gcassara/miniconda3/envs/lm-bio-kgc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1044, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for KGBERT: size mismatch for relation_head.weight: copying a param with shape torch.Size([6, 768]) from checkpoint, the shape in current model is torch.Size([5, 768]). size mismatch for relation_head.bias: copying a param with shape torch.Size([6]) from checkpoint, the shape in current model is torch.Size([5]).

I think the correct n__relations is

nrelations = {'repodb' : 1, 'hetionet' : 4, 'msi' : 6}

rahuln commented 3 years ago

Thanks for raising this issue! You're right, the correct number of relations for the MSI dataset is 6 (you can see the specific relations in the file data/processed/msi-relations.tsv). The README has been updated to address this.