Skip to main content

spacy-transformers: Use pretrained transformers like BERT, XLNet and GPT-2 in spaCy

This package provides spaCy components and architectures to use transformer models via Hugging Face's transformers in spaCy. The result is convenient access to state-of-the-art transformer architectures, such as BERT, GPT-2, XLNet, etc.

This release requires spaCy v3. For the previous version of this library, see the v0.6.x branch.

tests PyPi GitHub Code style: black

Features

  • Use pretrained transformer models like BERT, RoBERTa and XLNet to power your spaCy pipeline.
  • Easy multi-task learning: backprop to one transformer model from several pipeline components.
  • Train using spaCy v3's powerful and extensible config system.
  • Automatic alignment of transformer output to spaCy's tokenization.
  • Easily customize what transformer data is saved in the Doc object.
  • Easily customize how long documents are processed.
  • Out-of-the-box serialization and model packaging.

🚀 Installation

Installing the package from pip will automatically install all dependencies, including PyTorch and spaCy. Make sure you install this package before you install the models. Also note that this package requires Python 3.6+, PyTorch v1.5+ and spaCy v3.0+.

pip install 'spacy[transformers]'

For GPU installation, find your CUDA version using nvcc --version and add the version in brackets, e.g. spacy[transformers,cuda92] for CUDA9.2 or spacy[transformers,cuda100] for CUDA10.0.

If you are having trouble installing PyTorch, follow the instructions on the official website for your specific operating system and requirements.

📖 Documentation

⚠️ Important note: This package has been extensively refactored to take advantage of spaCy v3.0. Previous versions that were built for spaCy v2.x worked considerably differently. Please see previous tagged versions of this README for documentation on prior versions.

Applying pretrained text and token classification models

Note that the transformer component from spacy-transformers does not support task-specific heads like token or text classification. A task-specific transformer model can be used as a source of features to train spaCy components like ner or textcat, but the transformer component does not provide access to task-specific heads for training or inference.

Alternatively, if you only want use to the predictions from an existing Hugging Face text or token classification model, you can use the wrappers from spacy-huggingface-pipelines to incorporate task-specific transformer models into your spaCy pipelines.

Bug reports and other issues

Please use spaCy's issue tracker to report a bug, or open a new thread on the discussion board for any other issue.

Metadata

Release files for spacy-transformers 1.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for spacy-transformers 1.3.7
File
spacy_transformers-1.3.7-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_aarch64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ ARM64 Details
spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
spacy_transformers-1.3.7-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
spacy_transformers-1.3.7-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details

Total release size: 5.4 MB

Release files / spacy_transformers-1.3.7-cp310-cp310-win_amd64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-win_amd64.whl
Size 344.5 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
a3be6600c9ef8082ef74003491e33364e4288d75ff0955e06dd7e1a7ecb1d895
BLAKE2b-256 checksum
How to use checksums
fff3e5591fe1fafae7c7797eb1130579696649f7a58b4f3c6cf186c3bf3b224c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_x86_64.whl
Size 1.7 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
bbda1c1f75852774d09e7a1654dbeaa2f960b69c86855e7cfdbe62fbdfc3d8fb
BLAKE2b-256 checksum
How to use checksums
a7e2a0e2aaf1efb1c4c2bd98e134eff0a9c17ce02da32d2017e8b864556a20ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_aarch64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-musllinux_1_2_aarch64.whl
Size 1.6 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64
SHA-256 checksum
How to use checksums
3dd61ad60069e6a9d5723a2772e267185475277a70869fa606b59200b993b16d
BLAKE2b-256 checksum
How to use checksums
48742ebeb7aca054a3bb9ff7615924f6ba207c8041a2bab01057b058b171de33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 716.3 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a5eb303e9fdb831819fce379de2baba7e119313365748d9776adad68f38307dc
BLAKE2b-256 checksum
How to use checksums
8fea3c003d517669be87ff6de94dd0827977a723696161539d62a243fed098c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 709.0 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
8cc2d5da9b4a544f75c3418c38d7e85760a71e441216d10359b7b0618246a88a
BLAKE2b-256 checksum
How to use checksums
b1b28d250ea0d024fc2edfc0908f82bb3c48edd761a4835b46f5357c59abbb6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-macosx_11_0_arm64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-macosx_11_0_arm64.whl
Size 171.1 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d908f3b000b0729d9c084b1ec06ec07b0322936f757288dc5f5553c80f6b9982
BLAKE2b-256 checksum
How to use checksums
fc914d9c9b1b1552230f6c0ad1a65e109ec1a75752af93a2c0d7e7da33a5b142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release files / spacy_transformers-1.3.7-cp310-cp310-macosx_10_9_x86_64.whl

Download URL spacy_transformers-1.3.7-cp310-cp310-macosx_10_9_x86_64.whl
Size 177.2 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
ec6974dff4a3792bb2cb854a19bbdd385e452940bd52adf13df002f5732fe14a
BLAKE2b-256 checksum
How to use checksums
1a487639066333ef39b45b3acf7dbf8dcedc60028c21ac15213ec70833b89bbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2025.

Transparency log

Release history Release notifications | RSS feed

1.4.0

40 release files

1.3.9

36 release files

This release

1.3.7 This release

7 release files

1.3.5

29 release files

1.3.4

25 release files

1.3.2

29 release files

1.3.1

29 release files

1.2.5

28 release files

1.2.4

28 release files

1.2.3

27 release files

1.2.2

24 release files

1.2.1

24 release files

1.2.0

19 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.2

2 release files

0.6.1

1 release file

0.6.0

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page