The popular NLP library spaCy has integrated with the Hugging Face Hub, making it easier than ever to share and use spaCy pipelines. With a single command, users can upload any pipeline package, complete with auto-generated metadata and a model card. The Hub's inference API supports named entity recognition (NER) out of the box, allowing interactive testing in the browser and providing a direct URL for pip install.
Over 60 canonical models from spaCy's latest 3.1 release are available in the spaCy organization. Community models can be found here. The integration includes NER widgets, with text classification and part-of-speech support coming soon.
To use existing models, simply install via pip:
pip install https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl
Then load with spacy.load('en_core_web_sm'). HTTP requests to the Inference API are also supported for production use.
To share custom models, install the spacy-huggingface-hub library and use:
huggingface-cli login
python -m spacy package ./en_ner_fashion ./output --build wheel
cd ./output/en_ner_fashion-0.0.0/dist
python -m spacy huggingface-hub push en_ner_fashion-0.0.0-py3-none-any.whl
The model will be uploaded and available for interactive testing.
This integration is powered by the huggingface_hub library. Library authors interested in integrating their own tools can follow the guide.