yao8839836 / kg-bert

KG-BERT: BERT for Knowledge Graph Completion
Apache License 2.0
679 stars 141 forks source link

How to implement pretrained model from the output folder #3

Closed moh-yani closed 4 years ago

moh-yani commented 4 years ago

I have run the run_bert_classifier.py. That process outputs a folder name output_FB15K. It contains .json; .bin and vocab.txt files. The question is how I can implement those files to check whether a given triple is correct or not?

For instance, if I give a triple 453 1347 37, how I can check if that triple is correct or not. Anyone could give an example script to do that?

yao8839836 commented 4 years ago

@moh-yani

The script should be similar to line 777--828 in run_bert_triple_classifier.py.

You need to assign your test triple 453 1347 37 to eval_examples in line 777 (which will have only one example),

then preds in line 828 will be the label which indicates if the triple is correct or not.

moh-yani commented 4 years ago

@yao8839836

If I assign the triple to eval_example in line 777, does it mean I just need to assign the Ids (such as 453 1347 37) or completely assign the mids in the test.tsv file (for instance: /m/01qscs /award/award_nominee/award_nominations./award/award_nomination/award /m/02x8n1n)?