--- id: spacy-transformers version: "1.4.0" license: MIT license_treatment: permissive maintenance: active --- # spacy-transformers — spaCy pipelines for pre-trained BERT and other transformers License: permissive · Maintenance: active · Downloads: 271.1K/mo ## 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 above — verify before relying. Integrates pretrained transformer models (BERT, RoBERTa, XLNet, GPT-2) into spaCy pipelines via Hugging Face's transformers library, enabling state-of-the-art neural NLP components with automatic tokenization alignment. 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 pip install spacy-transformers uv add spacy-transformers poetry add spacy-transformers ## Installing spacy-transformers 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. 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') 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. 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_current - Install friction: medium - Maintenance: active - Downloads: 271.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags transformer models in spacy, bert spacy pipeline, hugging face transformers spacy, pretrained nlp models spacy, spacy neural components, transformer embeddings spacy, multi-task learning nlp, transformer-models, spacy-extension, nlp-pipeline [View on SkillFed](https://skillfed.io/packages/spacy-transformers) · [View on PyPI](https://pypi.org/project/spacy-transformers/)