lavis-nlp / spert

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

How to easily use this model for inference #51

Open xegulon opened 3 years ago

xegulon commented 3 years ago

Hi, thanks for the amazing work

Is there a snippet somewhere explaining how to efficiently use the model for inference?

Like this:

s = "The sequence I wanna extract the relations from"
nlp(s)
>>> dict_of_relations(...)

Thanks a lot!

markus-eberts commented 3 years ago

Unfortunately this is currently not supported. As a workaround, you could use the prediction mode, which saves the predictions to disk. Maybe I will add this someday, so the model can be directly used for inference in Python, but I cannot make any promises.

ader456 commented 3 years ago

Can Spert run on CPU in ubuntu VIRTUAL machine

markus-eberts commented 3 years ago

@ader456 Yes I think so.