Hi. I have trained a relation extraction model using rel.manual recipe. I have the trained model now and just want to view all the predictions by the relation extraction model through prodigy's interface and make changes if there are any on new data. So basically what ner.correct does but for relation extraction. Is there a way to do this? I can get the annotations from the NER model by using --add-ents flag. However I don't know how to do the same using relation extraction model. Is it possible?
Hi! There's currently no
rel.correct workflow, since relation extraction isn't an official spaCy component (yet) and there's no built-in unified data structure for accessing relations (like the
doc.ents). So depending on how your component is structured and how it sets the annotations, the format will be different and we can't easily have a general-purpose recipe.
That said, what you can do is add a simple script that processes your data with the model and outputs JSON in Prodigy's format: https://prodi.gy/docs/api-interfaces#relations If the
"relations" are pre-defined in the input data, you should be able to load and render them in the
rel.manual recipe and
Thanks for the response. Where should I be using the script to generate the 'relations' field? Do I have to run predictions from relation extractor model on the whole input file and save it in a different file beforehand before using
Also, I was wondering if it would be possible to write a custom recipe as well? What I understand is that if in 'stream' field I yield data in the format prodigy understands relations, it should work right
Also, just out of curiosity, are there plans to make relation extraction officially supported through spacy sometime in the near future?
Yes, exactly, that's the other option If your
stream yields examples in Prodigy's JSON format expected by the
relations UI, it should work out-of-the-box. And then you can just load your model in Python.
It's definitely on the roadmap and it mostly comes down to finding an implementation that works well across different use cases. So we don't have an ETA for this yet.