Repolode
explosion

explosion/thinc

A lightweight, type-checked functional deep learning library for composing models and wrapping PyTorch, TensorFlow and MXNet layers.

Stars
2,889
Forks
295
Open issues
17
Last commit
11 days ago

What is it?

Thinc is a lightweight deep learning library from the makers of spaCy and Prodigy. It provides a functional-programming API for building models by composing layers rather than through class inheritance, and the API is type-checked so model definitions can be verified with mypy.

Thinc can wrap models written in PyTorch, TensorFlow and MXNet so they can be used inside a Thinc network, letting you mix layers from those frameworks. It also includes a config system for describing trees of objects and hyperparameters, a function registry for custom functions, and optimizers such as SGD, Adam and RAdam. It runs on Linux, macOS and Windows and is installed with pip.

The library can serve as an interface layer between frameworks, a standalone toolkit, or a base for developing new models. Its documentation includes notebooks covering MNIST training, transformer-based part-of-speech tagging and parallel training with Ray.

Key features

  • 01Type-checks model definitions with a mypy plugin.
  • 02Wraps PyTorch, TensorFlow and MXNet models for use in a network.
  • 03Composes models functionally rather than through inheritance.
  • 04Provides a config system and function registry for hyperparameters and objects.
  • 05Includes SGD, Adam and RAdam optimizers and loss functions.

Use cases

  • Building custom NLP models that combine layers from PyTorch or TensorFlow.
  • Training models with reproducible, file-based configuration.
  • Adding static type checking to deep learning model code.
  • Running parallel parameter server training with Ray.

Quick start

  1. 1

    Upgrade pip, setuptools and wheel

    pip install -U pip setuptools wheel
  2. 2

    Install Thinc from PyPI

    pip install thinc

Things to know

  • Some backends such as PyTorch or TensorFlow need extra optional dependencies and setup beyond the base install.

In collections

Topics

FAQ

What is thinc?
A lightweight, type-checked functional deep learning library for composing models and wrapping PyTorch, TensorFlow and MXNet layers. Thinc is a lightweight deep learning library from the makers of spaCy and Prodigy. It provides a functional-programming API for building models by composing layers rather than through class inheritance, and the API is type-checked so model definitions can be verified with mypy.
Is thinc free to use? What license does it have?
thinc is open source under the MIT license. Check the license terms before using it in commercial products.
Is thinc still maintained?
Actively maintained. The last commit to thinc was on Oct 27, 2026.
What can I use thinc for?
Building custom NLP models that combine layers from PyTorch or TensorFlow. Training models with reproducible, file-based configuration. Adding static type checking to deep learning model code. Running parallel parameter server training with Ray.
How do I install thinc?
Upgrade pip, setuptools and wheel: pip install -U pip setuptools wheel Install Thinc from PyPI: pip install thinc
Where can I get thinc?
The source code and installation instructions are on GitHub: https://github.com/explosion/thinc

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects