rstudio / vetiver-python

Version, share, deploy, and monitor models.
https://rstudio.github.io/vetiver-python/stable/
MIT License
60 stars 17 forks source link

[FEAT] implement spacy models #143

Closed isabelizimm closed 1 year ago

isabelizimm commented 1 year ago

closes #121

isabelizimm commented 1 year ago

~~at this state: figuring out how to handle non-serializable data types. this is implementing an interface to the .predict() methods on the Pipeline spaCy objects. Tests are not passing since spaCy requires a spacy.tokens.Doc object to make a prediction, which needs to be converted to json before POSTed to API endpoint. ~~

I could see that other frameworks have similar specific format. It might be useful to make the predict function single dispatch and then be able to register new data types in the spacy.py file.

Spacy can be pickled! Updated from predict() method on spaCy Pipelines to the nlp object

isabelizimm commented 1 year ago

This worked well for me and looks good! 👍 I have two additional thoughts:

  • (do now in this PR) can you update the README to include spaCy now?

Added!

  • (let's think on this for future) how should we surface some model-specific documentation now that the number of supported models is growing?

That sounds like a great idea. Off the bat, the model handlers are shown in the docs. It might be advantageous to add examples of each model in the examples/ directory, in docstrings, or both.