OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

Spacy Wrap

Spacy Wrap is a Python library that lets developers add fine-tuned Hugging Face transformer models to spaCy pipelines. Its examples cover sequence classification, token classification and named-entity recognition, with predictions made available through spaCy document extensions, categories, token attributes or entities.

Independent OpenViST project profile, based on linked sources.

Spacy Wrap — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. Install spaCy-wrap with the command below.

    Documented command
    pip install spacy_wrap
  2. Import spacy and spacy_wrap, then create a blank English pipeline with nlp = spacy.blank("en").

  3. Set the model name to distilbert-base-uncased-finetuned-sst-2-english and configure doc_extension_trf_data as clf_trf_data and doc_extension_prediction as sentiment.

  4. Add the component with nlp.add_pipe("sequence_classification_transformer", config=config), then process text with doc = nlp("spaCy is a wonderful tool").

  5. Read the output from doc.cats, doc._.sentiment, or doc._.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.
Evidence and transparency

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.