thinc 9.1.1


pip install thinc

  Latest version

Released: Sep 12, 2024

Project Links

Meta
Author: Explosion
Requires Python: >=3.9

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Console

Intended Audience
  • Developers
  • Science/Research

License
  • OSI Approved :: MIT License

Operating System
  • POSIX :: Linux
  • MacOS :: MacOS X
  • Microsoft :: Windows

Programming Language
  • Cython
  • Python :: 3
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12

Topic
  • Scientific/Engineering

Thinc: A refreshing functional take on deep learning, compatible with your favorite libraries

From the makers of spaCy and Prodigy

Thinc is a lightweight deep learning library that offers an elegant, type-checked, functional-programming API for composing models, with support for layers defined in other frameworks such as PyTorch, TensorFlow and MXNet. You can use Thinc as an interface layer, a standalone toolkit or a flexible way to develop new models. Previous versions of Thinc have been running quietly in production in thousands of companies, via both spaCy and Prodigy. We wrote the new version to let users compose, configure and deploy custom models built with their favorite framework.

tests Current Release Version PyPi Version conda Version Python wheels Code style: black Open demo in Colab

๐Ÿ”ฅ Features

  • Type-check your model definitions with custom types and mypy plugin.
  • Wrap PyTorch, TensorFlow and MXNet models for use in your network.
  • Concise functional-programming approach to model definition, using composition rather than inheritance.
  • Optional custom infix notation via operator overloading.
  • Integrated config system to describe trees of objects and hyperparameters.
  • Choice of extensible backends.
  • Read more โ†’

๐Ÿš€ Quickstart

Thinc is compatible with Python 3.6+ and runs on Linux, macOS and Windows. The latest releases with binary wheels are available from pip. Before you install Thinc and its dependencies, make sure that your pip, setuptools and wheel are up to date. For the most recent releases, pip 19.3 or newer is recommended.

pip install -U pip setuptools wheel
pip install thinc

See the extended installation docs for details on optional dependencies for different backends and GPU. You might also want to set up static type checking to take advantage of Thinc's type system.

โš ๏ธ If you have installed PyTorch and you are using Python 3.7+, uninstall the package dataclasses with pip uninstall dataclasses, since it may have been installed by PyTorch and is incompatible with Python 3.7+.

๐Ÿ““ Selected examples and notebooks

Also see the /examples directory and usage documentation for more examples. Most examples are Jupyter notebooks โ€“ to launch them on Google Colab (with GPU support!) click on the button next to the notebook name.

Notebook Description
intro_to_thinc
Open in Colab
Everything you need to know to get started. Composing and training a model on the MNIST data, using config files, registering custom functions and wrapping PyTorch, TensorFlow and MXNet models.
transformers_tagger_bert
Open in Colab
How to use Thinc, transformers and PyTorch to train a part-of-speech tagger. From model definition and config to the training loop.
pos_tagger_basic_cnn
Open in Colab
Implementing and training a basic CNN for part-of-speech tagging model without external dependencies and using different levels of Thinc's config system.
parallel_training_ray
Open in Colab
How to set up synchronous and asynchronous parameter server training with Thinc and Ray.

View more โ†’

๐Ÿ“– Documentation & usage guides

Documentation Description
Introduction Everything you need to know.
Concept & Design Thinc's conceptual model and how it works.
Defining and using models How to compose models and update state.
Configuration system Thinc's config system and function registry.
Integrating PyTorch, TensorFlow & MXNet Interoperability with machine learning frameworks
Layers API Weights layers, transforms, combinators and wrappers.
Type Checking Type-check your model definitions and more.

๐Ÿ—บ What's where

Module Description
thinc.api User-facing API. All classes and functions should be imported from here.
thinc.types Custom types and dataclasses.
thinc.model The Model class. All Thinc models are an instance (not a subclass) of Model.
thinc.layers The layers. Each layer is implemented in its own module.
thinc.shims Interface for external models implemented in PyTorch, TensorFlow etc.
thinc.loss Functions to calculate losses.
thinc.optimizers Functions to create optimizers. Currently supports "vanilla" SGD, Adam and RAdam.
thinc.schedules Generators for different rates, schedules, decays or series.
thinc.backends Backends for numpy and cupy.
thinc.config Config parsing and validation and function registry system.
thinc.util Utilities and helper functions.

๐Ÿ Development notes

Thinc uses black for auto-formatting, flake8 for linting and mypy for type checking. All code is written compatible with Python 3.6+, with type hints wherever possible. See the type reference for more details on Thinc's custom types.

๐Ÿ‘ทโ€โ™€๏ธ Building Thinc from source

Building Thinc from source requires the full dependencies listed in requirements.txt to be installed. You'll also need a compiler to build the C extensions.

git clone https://github.com/explosion/thinc
cd thinc
python -m venv .env
source .env/bin/activate
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install --no-build-isolation .

Alternatively, install in editable mode:

pip install -r requirements.txt
pip install --no-build-isolation --editable .

Or by setting PYTHONPATH:

export PYTHONPATH=`pwd`
pip install -r requirements.txt
python setup.py build_ext --inplace

๐Ÿšฆ Running tests

Thinc comes with an extensive test suite. The following should all pass and not report any warnings or errors:

python -m pytest thinc    # test suite
python -m mypy thinc      # type checks
python -m flake8 thinc    # linting

To view test coverage, you can run python -m pytest thinc --cov=thinc. We aim for a 100% test coverage. This doesn't mean that we meticulously write tests for every single line โ€“ we ignore blocks that are not relevant or difficult to test and make sure that the tests execute all code paths.

9.1.1 Sep 12, 2024
9.1.0 Sep 02, 2024
9.0.0 Apr 19, 2024
9.0.0.dev5 Apr 08, 2024
9.0.0.dev4 Jan 16, 2024
9.0.0.dev3 Mar 23, 2023
9.0.0.dev2 Jan 13, 2023
9.0.0.dev1 Dec 23, 2022
9.0.0.dev0 Dec 09, 2022
8.3.6 Apr 04, 2025
8.3.5 Apr 03, 2025
8.3.4 Jan 13, 2025
8.3.3 Dec 16, 2024
8.3.2 Oct 01, 2024
8.3.1 Sep 30, 2024
8.3.0 Jul 31, 2024
8.2.5 Jun 19, 2024
8.2.4 Jun 04, 2024
8.2.3 Feb 07, 2024
8.2.2 Dec 14, 2023
8.2.1 Sep 22, 2023
8.2.0 Aug 11, 2023
8.1.12 Aug 11, 2023
8.1.11 Aug 07, 2023
8.1.10 May 03, 2023
8.1.9 Mar 07, 2023
8.1.8 Mar 02, 2023
8.1.7 Jan 13, 2023
8.1.6 Dec 20, 2022
8.1.5 Oct 19, 2022
8.1.4 Oct 12, 2022
8.1.3 Oct 07, 2022
8.1.2 Sep 27, 2022
8.1.1 Sep 09, 2022
8.1.0 Jul 08, 2022
8.1.0.dev3 Jun 22, 2022
8.1.0.dev2 Jun 16, 2022
8.1.0.dev1 Jun 14, 2022
8.1.0.dev0 May 20, 2022
8.0.17 Jun 02, 2022
8.0.16 May 19, 2022
8.0.15 Mar 15, 2022
8.0.14 Mar 14, 2022
8.0.14.dev0 Dec 17, 2021
8.0.13 Nov 05, 2021
8.0.12 Oct 28, 2021
8.0.11 Oct 20, 2021
8.0.10 Sep 07, 2021
8.0.9 Sep 03, 2021
8.0.8 Jul 19, 2021
8.0.7 Jul 01, 2021
8.0.6 Jun 21, 2021
8.0.5 Jun 16, 2021
8.0.4 Jun 11, 2021
8.0.3 Apr 19, 2021
8.0.2 Mar 09, 2021
8.0.1 Jan 24, 2021
8.0.0 Jan 21, 2021
8.0.0rc6 Jan 21, 2021
8.0.0rc6.dev0 Jan 21, 2021
8.0.0rc5 Jan 21, 2021
8.0.0rc4 Jan 18, 2021
8.0.0rc3 Dec 16, 2020
8.0.0rc2 Nov 03, 2020
8.0.0rc1 Oct 26, 2020
8.0.0rc0 Oct 14, 2020
8.0.0a44 Oct 10, 2020
8.0.0a43 Oct 01, 2020
8.0.0a42 Sep 29, 2020
8.0.0a41 Sep 27, 2020
8.0.0a40 Sep 27, 2020
8.0.0a36 Sep 26, 2020
8.0.0a35 Sep 24, 2020
8.0.0a34 Sep 18, 2020
8.0.0a33 Sep 17, 2020
8.0.0a32 Sep 08, 2020
8.0.0a31 Sep 06, 2020
8.0.0a30 Aug 24, 2020
8.0.0a29 Aug 23, 2020
8.0.0a28 Aug 19, 2020
8.0.0a27 Aug 14, 2020
8.0.0a26 Aug 14, 2020
8.0.0a25 Aug 13, 2020
8.0.0a24 Aug 12, 2020
8.0.0a23 Aug 07, 2020
8.0.0a22 Aug 05, 2020
8.0.0a21 Aug 03, 2020
8.0.0a20 Jul 29, 2020
8.0.0a19 Jul 21, 2020
8.0.0a18 Jul 19, 2020
8.0.0a17 Jul 11, 2020
8.0.0a16 Jul 10, 2020
8.0.0a14 Jul 10, 2020
8.0.0a13 Jul 09, 2020
8.0.0a12 Jul 03, 2020
8.0.0a11 Jun 26, 2020
8.0.0a9 May 19, 2020
8.0.0a8 May 16, 2020
8.0.0a6 May 11, 2020
8.0.0a3 Mar 24, 2020
8.0.0a2 Mar 13, 2020
8.0.0a1 Feb 12, 2020
8.0.0a0 Jan 28, 2020
8.0.0.dev4 Jan 27, 2020
8.0.0.dev2 Jan 23, 2020
8.0.0.dev0 Jan 19, 2020
7.4.6 Oct 18, 2022
7.4.5 Dec 11, 2020
7.4.4 Dec 08, 2020
7.4.3 Nov 23, 2020
7.4.2 Nov 04, 2020
7.4.1 May 24, 2020
7.4.0 Feb 25, 2020
7.4.0.dev2 Feb 16, 2020
7.4.0.dev1 Dec 21, 2019
7.4.0.dev0 Dec 09, 2019
7.3.1 Oct 30, 2019
7.3.0 Oct 28, 2019
7.3.0.dev0 Oct 28, 2019
7.2.0 Oct 20, 2019
7.2.0.dev3 Oct 20, 2019
7.1.1 Sep 10, 2019
7.1.0 Aug 23, 2019
7.1.0.dev0 Aug 23, 2019
7.0.8 Jul 11, 2019
7.0.7 Jul 11, 2019
7.0.6 Jul 11, 2019
7.0.5 Jul 10, 2019
7.0.5.dev0 Jul 10, 2019
7.0.4 Mar 19, 2019
7.0.4.dev0 Mar 19, 2019
7.0.3 Mar 14, 2019
7.0.2 Feb 23, 2019
7.0.1 Feb 16, 2019
7.0.1.dev2 Feb 16, 2019
7.0.1.dev1 Feb 16, 2019
7.0.1.dev0 Feb 16, 2019
7.0.0 Feb 15, 2019
7.0.0.dev8 Feb 13, 2019
7.0.0.dev6 Dec 03, 2018
7.0.0.dev5 Dec 03, 2018
7.0.0.dev4 Dec 02, 2018
7.0.0.dev3 Nov 30, 2018
7.0.0.dev2 Nov 29, 2018
7.0.0.dev1 Nov 27, 2018
7.0.0.dev0 Nov 26, 2018
6.12.1 Nov 30, 2018
6.12.0 Oct 14, 2018
6.11.3.dev2 Nov 26, 2018
6.11.3.dev1 Sep 12, 2018
6.11.2 May 21, 2018
6.11.2.dev0 May 21, 2018
6.11.1 May 20, 2018
6.11.1.dev20 May 19, 2018
6.11.1.dev19 May 19, 2018
6.11.1.dev18 May 19, 2018
6.11.1.dev17 May 15, 2018
6.11.1.dev16 May 15, 2018
6.11.1.dev15 May 15, 2018
6.11.1.dev13 May 01, 2018
6.11.1.dev12 Apr 09, 2018
6.11.1.dev11 Mar 26, 2018
6.11.1.dev10 Mar 25, 2018
6.11.1.dev7 Mar 18, 2018
6.11.1.dev6 Mar 18, 2018
6.11.1.dev4 Mar 16, 2018
6.11.1.dev3 Mar 16, 2018
6.11.1.dev2 Mar 16, 2018
6.11.1.dev1 Mar 16, 2018
6.11.1.dev0 Mar 16, 2018
6.11.0.dev2 Mar 14, 2018
6.10.4.dev0 Oct 14, 2018
6.10.3 Jul 21, 2018
6.10.3.dev1 Jul 20, 2018
6.10.3.dev0 Jul 20, 2018
6.10.2 Dec 06, 2017
6.10.2.dev1 Dec 05, 2017
6.10.2.dev0 Dec 04, 2017
6.10.1 Nov 15, 2017
6.10.1.dev0 Nov 15, 2017
6.10.0 Oct 28, 2017
6.9.0 Oct 03, 2017
6.8.2 Sep 26, 2017
6.8.1 Sep 15, 2017
6.8.0 Jul 25, 2017
6.7.3 Jun 05, 2017
6.7.2 Jun 03, 2017
6.7.1 Jun 02, 2017
6.7.0 Jun 01, 2017
6.6.0 May 13, 2017
6.5.2 Mar 20, 2017
6.5.0 Mar 11, 2017
6.4.0 Feb 15, 2017
6.3.0 Jan 25, 2017
6.2.0 Jan 15, 2017
6.1.3 Jan 09, 2017
6.1.2 Jan 09, 2017
6.1.1 Jan 09, 2017
6.1.0 Jan 09, 2017
6.0.0 Dec 31, 2016
5.0.8 Apr 30, 2016
5.0.7 Mar 25, 2016
5.0.6 Mar 02, 2016
5.0.5 Feb 19, 2016
5.0.4 Feb 07, 2016
5.0.3 Feb 07, 2016
5.0.2 Feb 05, 2016
5.0.1 Feb 05, 2016
5.0.0 Feb 05, 2016
4.2.0 Dec 31, 2015
4.1.0 Dec 22, 2015
4.0.0 Nov 07, 2015
3.4.1 Nov 02, 2015
3.3 Jul 24, 2015
3.2 Jun 29, 2015
3.1 Jun 29, 2015
3.0 Jun 28, 2015
2.0 Jun 24, 2015
1.76 Jun 07, 2015
1.75 Mar 06, 2015
1.74 Feb 23, 2015
1.73 Jan 08, 2015
1.72 Jan 08, 2015
1.71 Jan 04, 2015
1.70 Jan 04, 2015
1.69 Jan 04, 2015
1.68 Jan 04, 2015
1.67 Jan 03, 2015
1.66 Jan 03, 2015
1.65 Jan 03, 2015
1.64 Jan 03, 2015
1.63 Jan 03, 2015
1.62 Jan 03, 2015
1.61 Jan 03, 2015
1.60 Jan 02, 2015
1.42 Feb 18, 2015
1.41 Feb 18, 2015
1.5 Jan 02, 2015
1.4 Nov 18, 2014
1.3 Nov 16, 2014
1.2 Oct 02, 2014
1.1 Oct 02, 2014
1.0 Oct 02, 2014

Wheel compatibility matrix

Platform CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux1_i686
manylinux2014_i686
manylinux2014_x86_64
manylinux_2_17_i686
manylinux_2_17_x86_64
manylinux_2_5_i686
musllinux_1_2_i686
musllinux_1_2_x86_64
win_amd64

Files in release

thinc-9.1.1-cp310-cp310-macosx_10_9_x86_64.whl (833.1KiB)
thinc-9.1.1-cp310-cp310-macosx_11_0_arm64.whl (766.8KiB)
thinc-9.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0MiB)
thinc-9.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.0MiB)
thinc-9.1.1-cp310-cp310-musllinux_1_2_i686.whl (4.1MiB)
thinc-9.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (4.0MiB)
thinc-9.1.1-cp310-cp310-win_amd64.whl (1.2MiB)
thinc-9.1.1-cp311-cp311-macosx_10_9_x86_64.whl (830.0KiB)
thinc-9.1.1-cp311-cp311-macosx_11_0_arm64.whl (762.9KiB)
thinc-9.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3MiB)
thinc-9.1.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.1MiB)
thinc-9.1.1-cp311-cp311-musllinux_1_2_i686.whl (4.3MiB)
thinc-9.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (4.2MiB)
thinc-9.1.1-cp311-cp311-win_amd64.whl (1.2MiB)
thinc-9.1.1-cp312-cp312-macosx_10_9_x86_64.whl (808.5KiB)
thinc-9.1.1-cp312-cp312-macosx_11_0_arm64.whl (746.7KiB)
thinc-9.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1MiB)
thinc-9.1.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (2.9MiB)
thinc-9.1.1-cp312-cp312-musllinux_1_2_i686.whl (4.1MiB)
thinc-9.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (4.1MiB)
thinc-9.1.1-cp312-cp312-win_amd64.whl (1.2MiB)
thinc-9.1.1-cp39-cp39-macosx_10_9_x86_64.whl (839.2KiB)
thinc-9.1.1-cp39-cp39-macosx_11_0_arm64.whl (770.8KiB)
thinc-9.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1MiB)
thinc-9.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (3.0MiB)
thinc-9.1.1-cp39-cp39-musllinux_1_2_i686.whl (4.2MiB)
thinc-9.1.1-cp39-cp39-musllinux_1_2_x86_64.whl (4.1MiB)
thinc-9.1.1-cp39-cp39-win_amd64.whl (1.2MiB)
thinc-9.1.1.tar.gz (187.4KiB)
Extras:
Dependencies:
blis (<1.1.0,>=1.0.0)
murmurhash (<1.1.0,>=1.0.2)
cymem (<2.1.0,>=2.0.2)
preshed (<3.1.0,>=3.0.2)
wasabi (<1.2.0,>=0.8.1)
srsly (<3.0.0,>=2.4.0)
catalogue (<2.1.0,>=2.0.4)
confection (<1.0.0,>=0.0.1)
setuptools
numpy (<3.0.0,>=2.0.0)
pydantic (!=1.8,!=1.8.1,<3.0.0,>=1.7.4)
packaging (>=20.0)