plkmo / BERT-Relation-Extraction

PyTorch implementation for "Matching the Blanks: Distributional Similarity for Relation Learning" paper
Apache License 2.0
565 stars 132 forks source link

Can't infer on my own sentences after finetuning model #42

Closed demongolem-biz closed 9 months ago

demongolem-biz commented 2 years ago

After training on my own data and then going to infer, if I type in one of the example sentences given, the expected result comes back. When I enter a typical sentence from my training data, I get the following error:

File "main_task.py", line 63, in

inferer.infer_sentence(sent, detect_entities=False) File "/home/gregory.werner/BERT-Relation-Extraction/src/tasks/infer.py", line 222, in infer_sentence return self.infer_one_sentence(sentence) File "/home/gregory.werner/BERT-Relation-Extraction/src/tasks/infer.py", line 193, in infer_one_sentence e1_e2_start = self.get_e1e2_start(tokenized); #print(e1_e2_start) File "/home/gregory.werner/BERT-Relation-Extraction/src/tasks/infer.py", line 186, in get_e1e2_start e1_e2_start = ([i for i, e in enumerate(x) if e == self.e1_id][0],\ IndexError: list index out of range

demongolem-biz commented 2 years ago

I see. In the training data and test data we were doing something like<e1> and then infer time we go to [E1]. I don't understand why the change because then to work on my test data, I need to convert all my tags to use the left and right brackets.

plkmo commented 9 months ago

Yes, the notations have been changed :)