How to train NER and Relation Extraction model together #9139
-
Hi,
Above is the output file when I annotate for Relation. Please guide me what are the key value pairs required to make it in spacy binary format.
Please help me to understand the flow. It will be a great help. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 26 replies
-
Don't use all capitals when creating an issue. As mentioned in the training data section of the docs, training data in spaCy just consists of making the I think you've already trained the components separately, but the NER annotations go in For some components you can provide special annotations that are to just be ignored, usually by giving a "-" label. This works for NER but I don't think there's anything equivalent for relation extraction. This means you should annotate all your data with both NER and relations. For the config, you just need to specify NER and relation extraction sections. The components should be in the pipeline in that order. You can see what a pipeline with multiple components looks like by using the Quickstart and specifying NER and textcat, for example. You might also want to experiment with specifying NER as an annotating component, since relation extraction uses the entity annotations. |
Beta Was this translation helpful? Give feedback.
-
Hi @polm , I am unable to understand whether this annotation structure is fine or it need changes before I convert this json annotated output to .spacy binary format. |
Beta Was this translation helpful? Give feedback.
-
@polm How I can visualize the relation and entities using DisplayC ? I can only see NER is being displayed by using Displayc but how both relation and Entities can be displayed together? Thanks |
Beta Was this translation helpful? Give feedback.
-
@karndeepsingh Hello, friend, I also want to make a ner and relation together model, but I don't know how to configure config, please ask, can you share your method, or config file, if you can thank you very much! |
Beta Was this translation helpful? Give feedback.
Don't use all capitals when creating an issue.
As mentioned in the training data section of the docs, training data in spaCy just consists of making the
Doc
objects you want to see as output from your model. One thing that's a little tricky is that you can't specify different training data for different components - if you want to train multiple components at the same time, you need give the same data to all of them. In this case this means that your training data needs both relation annotations and NER annotations on each individual doc. Because training data for relation extraction already includes entity labels you should just be able to use your relation extraction training data as is…