Installation & Setup

Thinc is compatible with 64-bit CPython 3.6+ and runs on Unix/Linux, macOS/OS X and Windows. The latest releases with binary wheels are available from pip.

pippip install "thinc==8.0.0a1"

Extended installation

Backends:(single-threaded matrix multiplication)(experimental)
Install commandpip install thinc[blis]==8.0.0a1

If you know your CUDA version, using the more explicit specifier allows cupy to be installed from a wheel, saving some compilation time. Once you have a GPU-enabled installation, the best way to activate it is to call prefer_gpu (will use GPU if available) or require_gpu (will raise an error if no GPU is available).

from thinc.api import prefer_gpu
is_gpu = prefer_gpu()

Set up static type checking

Thinc makes extensive use of type hints and includes various custom types for input and output types, like arrays of different shapes. This lets you type check your code and model definitions, and will show you errors if your inputs and outputs don’t match, greatly reducing time spent debugging. To use type checking, you can install mypy alongside Thinc. If you’re using an editor like Visual Studio Code, you can also enable mypy linting to get real-time feedback as you write code. For more details, check out the docs on using type checking.

pippip install mypy
plugins = thinc.mypy
Screenshot of mypy linting in Visual Studio Code