yao8839836 / kg-bert

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

list index out of error #20

Open ChloeJKim opened 3 years ago

ChloeJKim commented 3 years ago

Hello,

I ran the following command to do prediction but encountered this error:

python3 run_bert_triple_classifier.py --task_name kg --do_train --do_eval --do_predict --data_dir data/umls --bert_model bert-base-uncased --max_seq_length 20 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 3.0 --output_dir output/umls --gradient_accumulation_steps 1 --eval_batch_size 512

image

can you please help? thank you in advance

yao8839836 commented 3 years ago

@ChloeJKim

umls is not designed for triple classification, so there is no triple label (line[3]) in the data file.

ChloeJKim commented 3 years ago

Do you know what steps I need to follow? it I want to run either link/relation prediction on my own dataset? And also whenever I'm running this command below, do i need to train everytime?

python3 run_bert_link_prediction.py --task_name kg --do_train --do_eval --do_predict --data_dir data/umls --bert_model bert-base-uncased --max_seq_length 15 --train_batch_size 32 --learning_rate 5e-5 --num_train_epochs 5.0 --output_dir output/output_umls/ --gradient_accumulation_steps 1 --eval_batch_size 135

And approximately how long does it take to run this prediction?

Thank you so much for helping out!

yao8839836 commented 3 years ago

@ChloeJKim

You need to prepare triples with entity and relation names (descriptions) like data/umls.

After training on a dataset, you can run the command without --do_train, then the script will do evaluation and prediction using saved model in --output_dir.

UMLS takes several minitues using a V100 GPU, the larger the dataset, the more time.