spacy-transformers
spaCy pipelines for pre-trained BERT and other transformers
Decision gist · record as of 2026-08-14
Yes, if you need transformer models in spaCy. The package is actively maintained, has no known vulnerabilities, and integrates cleanly into spaCy's v3+ ecosystem. Install friction is moderate due to PyTorch and transformers dependencies, but prebuilt wheels cover standard platforms. Not necessary if you only need transformer predictions without spaCy's downstream components—use Hugging Face transformers directly in that case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PyTorch v1.5+, spaCy v3.0+, and Python 3.10+.
- GPU support requires CUDA toolkit; CPU-only installation is possible but slower for inference.
- Medium install friction due to 7 runtime dependencies including PyTorch, transformers, and spaCy.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
last release 2026-03-17 (150 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 271,076 downloads/mo, #8,224 on PyPI
Alternatives
Verify before relying
pip install 'spacy[transformers]'
import spacy
from spacy_transformers import Transformer
nlp = spacy.load('en_core_web_trf')
doc = nlp('Hello world')- Whether pretrained transformer models are bundled or must be downloaded separately from Hugging Face
- Memory and compute requirements for inference with large transformer models
- Performance characteristics compared to direct Hugging Face transformer use
What it is and what it does
spacy-transformers is a spaCy extension that wraps Hugging Face's transformer models to use them as feature extractors within spaCy pipelines. It handles the integration layer between transformer token outputs and spaCy's tokenization, allowing you to build NLP systems that combine transformer embeddings with spaCy's task-specific components (named entity recognition, text classification, dependency parsing, etc.). The package supports multi-task learning, where a single transformer backbone can backpropagate gradients from multiple downstream components simultaneously.
The package is designed for developers building production NLP systems who want to leverage state-of-the-art pretrained models without abandoning spaCy's configuration, training, and serialization workflows. It requires PyTorch and spaCy v3.0+, and comes with prebuilt wheels for modern Python versions and common platforms. The main constraint is the size and memory footprint of transformer models themselves—BERT-scale models require significant RAM and benefit from GPU acceleration.
Use it for
- Train named entity recognition or text classification on top of BERT embeddings using spaCy's standard training pipeline
- Build multi-task NLP systems where one transformer model feeds features to multiple downstream components
- Align transformer token outputs to spaCy's linguistic tokenization for languages with complex morphology
- Serialize and package transformer-based spaCy models for production deployment with built-in model versioning
- Customize which transformer layers and outputs are stored in the Doc object to balance memory and performance
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need transformer models in spaCy.
The package is actively maintained, has no known vulnerabilities, and integrates cleanly into spaCy's v3+ ecosystem. Install friction is moderate due to PyTorch and transformers dependencies, but prebuilt wheels cover standard platforms. Not necessary if you only need transformer predictions without spaCy's downstream components—use Hugging Face transformers directly in that case.
Install
spacy-transformers on PyPI
Before you install
Medium install friction due to 7 runtime dependencies including PyTorch, transformers, and spaCy. Prebuilt wheels available for Python 3.10–3.13 across macOS, Linux, and Windows. Last release 150 days ago with active maintenance status.
Requires PyTorch v1.5+, spaCy v3.0+, and Python 3.10+. GPU support requires CUDA toolkit; CPU-only installation is possible but slower for inference.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install 'spacy[transformers]'
import spacy
from spacy_transformers import Transformer
nlp = spacy.load('en_core_web_trf')
doc = nlp('Hello world')
Verify before relying
- Whether pretrained transformer models are bundled or must be downloaded separately from Hugging Face
- Memory and compute requirements for inference with large transformer models
- Performance characteristics compared to direct Hugging Face transformer use
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 7 packagesspacynumpytransformerstorchsrslydataclassesspacy-alignments |
| Maintenance | Actively maintained 150 days since the last release |
| First released | |
| Downloads | 271,076 / month, #8,224 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: spacy_transformers-1.4.0-cp310-cp310-macosx_10_9_x86_64.whl; spacy_transformers-1.4.0-cp310-cp310-macosx_11_0_arm64.whl; spacy_transformers-1.4.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; spacy_transformers-1.4.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; spacy_transformers-1.4.0-cp310-cp310-musllinux_1_2_aarch64.whl; spacy_transformers-1.4.0-cp310-cp310-musllinux_1_2_x86_64.whl; spacy_transformers-1.4.0-cp310-cp310-win_amd64.whl; spacy_transformers-1.4.0-cp311-cp311-macosx_10_9_x86_64.whl; spacy_transformers-1.4.0-cp311-cp311-macosx_11_0_arm64.whl; spacy_transformers-1.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; spacy_transformers-1.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; spacy_transformers-1.4.0-cp311-cp311-musllinux_1_2_aarch64.whl; spacy_transformers-1.4.0-cp311-cp311-musllinux_1_2_x86_64.whl; spacy_transformers-1.4.0-cp311-cp311-win_amd64.whl; spacy_transformers-1.4.0-cp311-cp311-win_arm64.whl; spacy_transformers-1.4.0-cp312-cp312-macosx_10_13_x86_64.whl; spacy_transformers-1.4.0-cp312-cp312-macosx_11_0_arm64.whl; spacy_transformers-1.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; spacy_transformers-1.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; spacy_transformers-1.4.0-cp312-cp312-musllinux_1_2_aarch64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “transformer models in spacy”
- spacy-transformersIntegrates pretrained transformer models (BERT, RoBERTa, XLNet,…
- spacy-curated-transformersIntegrates curated transformer models (ALBERT, BERT, CamemBERT,…
- spacy-alignmentsAligns tokenizations between spaCy and transformer models by mapping…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also pytorch-pretrained-bert · sentence-transformers · spacy-alignments · spacy-curated-transformers · transformers · spacy · xformers · curated-transformers · spacy-loggers · transformers-stream-generator