lavis-nlp / spert

PyTorch code for SpERT: Span-based Entity and Relation Transformer
MIT License
692 stars 148 forks source link

How to call only the relation classifier on a pair of entities? #55

Closed vinhkhuc closed 3 years ago

vinhkhuc commented 3 years ago

Hi, Thanks for the great work. I plan to use SpERT's relation classifier together with SpaCy's NER. For a given sentence, I can run NER to get entities then I want to use SpERT to find the relations between any two entities.

I wonder if anyone can point me to the code that can do that. Thanks!

celsofranssa commented 3 years ago

Any update on this?

markus-eberts commented 3 years ago

Hi, since SpERT is built for joint entity and relation extraction, the current code is not suitable for a classification setting (given two entities). In this case, some modifications (especially regarding sampling and model architecture) are required. This is out of scope for this project - however, if you need some help to adjust the code to your needs, feel free to write me an email.