Practical overview
When it fits
Use it when a fine-tuned Hugging Face transformer needs to participate in a spaCy workflow, especially when working more directly with transformer outputs is relevant.
Who it is for
- Python developers building spaCy natural-language-processing workflows.
- Teams seeking to use an existing fine-tuned Hugging Face model within a spaCy pipeline.
Documented uses
- Add an existing transformer model to a spaCy pipeline.
- Classify text, including sentiment or hate-speech examples.
- Expose token-classification predictions or named entities through spaCy outputs.
- Process multiple documents using spaCy's nlp.pipe.
Requirements & limits
The README gives a pip installation command and identifies Python 3.8 or newer. Repository metadata lists an MIT license.
- The README demonstrates sequence classification, token classification and named-entity recognition.
- The project processes multiple documents through spaCy's nlp.pipe interface.
- Spacy Wrap aggregates tokens and converts results into spans from model logits; spacy-huggingface-pipelines instead wraps the Hugging Face pipeline and may produce different results.
- The project recommends spacy-huggingface-pipelines for most use cases, while noting Spacy Wrap may suit workflows needing more direct transformer output.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Add a fine-tuned sentiment transformer to a spaCy pipeline
Install spaCy-wrap and configure the documented SST-2 sentiment model in a blank English spaCy pipeline.
Before you start
- Python 3.8 or later, as indicated by the repository badge.
- spaCy and spaCy-wrap installed in the Python environment.
- A fine-tuned Hugging Face model; this example uses distilbert-base-uncased-finetuned-sst-2-english.
Steps
Install spaCy-wrap with the command below.
pip install spacy_wrapImport
spacyandspacy_wrap, then create a blank English pipeline withnlp = spacy.blank("en").Set the model name to
distilbert-base-uncased-finetuned-sst-2-englishand configuredoc_extension_trf_dataasclf_trf_dataanddoc_extension_predictionassentiment.Add the component with
nlp.add_pipe("sequence_classification_transformer", config=config), then process text withdoc = nlp("spaCy is a wonderful tool").Read the output from
doc.cats,doc._.sentiment, ordoc._.clf_trf_data; the example shows positive sentiment.
Expected outcome
A spaCy pipeline configured to apply the fine-tuned sentiment model and expose its classification and transformer data on the processed document.
Guide limitations
- The project notes that token aggregation and span conversion can produce differences because spaCy-wrap operates on model logits; it recommends spacy-huggingface-pipelines for most use cases and identifies spaCy-wrap as useful when more direct transformer output is needed.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- KennethEnevoldsen/spacy-wrap · Official homepage title · retained in its source language
Related options
spacy-huggingface-pipelines — The README identifies it as an alternative that wraps the Hugging Face pipeline rather than the transformer and recommends it for most use cases.

