thinc
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 66 committers (4.5%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.6%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries
Basic Info
- Host: GitHub
- Owner: explosion
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://thinc.ai
- Size: 10.6 MB
Statistics
- Stars: 2,869
- Watchers: 77
- Forks: 282
- Open Issues: 20
- Releases: 88
Topics
Metadata Files
README.md
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.
🔥 Features
- Type-check your model definitions with custom types and
mypyplugin. - 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.
bash
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
dataclasseswithpip 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 | 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 | 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 | 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 | How to set up synchronous and asynchronous parameter server training with Thinc and Ray. |
📖 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.
bash
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:
bash
pip install -r requirements.txt
pip install --no-build-isolation --editable .
Or by setting PYTHONPATH:
bash
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:
bash
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.
Owner
- Name: Explosion
- Login: explosion
- Kind: organization
- Email: contact@explosion.ai
- Location: Berlin, Germany
- Website: https://explosion.ai
- Twitter: explosion_ai
- Repositories: 61
- Profile: https://github.com/explosion
A software company specializing in developer tools for Artificial Intelligence and Natural Language Processing
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use Thinc in research, please use this as a citation.
title: Thinc
abstract: "🔮 A refreshing functional take on deep learning, compatible with your favorite libraries"
authors:
- family-names: "Honnibal"
given-names: "Matthew"
- family-names: "Montani"
given-names: "Ines"
- family-names: "Van Landeghem"
given-names: "Sofie"
- family-names: "Boyd"
given-names: "Adriane"
- family-names: "DuJardin"
given-names: "Justin"
version: 8.0.0
date-released: "2021-01-21"
license: MIT
repository-code: "https://github.com/explosion/thinc"
GitHub Events
Total
- Create event: 14
- Release event: 4
- Issues event: 8
- Watch event: 63
- Delete event: 9
- Member event: 1
- Issue comment event: 31
- Push event: 17
- Pull request review event: 1
- Pull request review comment event: 1
- Pull request event: 13
- Fork event: 10
Last Year
- Create event: 14
- Release event: 4
- Issues event: 8
- Watch event: 63
- Delete event: 9
- Member event: 1
- Issue comment event: 31
- Push event: 17
- Pull request review event: 1
- Pull request review comment event: 1
- Pull request event: 13
- Fork event: 10
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Matthew Honnibal | h****h@g****m | 2,703 |
| Matthew Honnibal | h****l@g****m | 785 |
| Ines Montani | i****s@i****o | 654 |
| Sofie Van Landeghem | s****g | 141 |
| Adriane Boyd | a****d@g****m | 124 |
| Daniël de Kok | me@d****u | 124 |
| justindujardin | j****n@d****m | 80 |
| Henning Peters | p****e@d****e | 52 |
| Madeesh Kannan | s****e | 34 |
| Sebastián Ramírez | t****o@g****m | 18 |
| Giannis Daras | d****s@g****m | 17 |
| kadarakos | k****s@g****m | 12 |
| github-actions[bot] | 4****] | 10 |
| Dani | d****l@r****i | 8 |
| Stefan Behnel | s****b@s****e | 7 |
| Matthew Honnibal | m****w@h****m | 6 |
| Paul O'Leary McCann | p****m@d****m | 6 |
| Richard Hudson | r****d@e****i | 5 |
| Marcus Blättermann | m****s@e****e | 4 |
| Raphael Mitsch | r****h@o****m | 4 |
| Abhijit Balaji | b****t@y****m | 2 |
| Aleph Melo | a****o@i****m | 2 |
| Charles Coulombe | c****e | 2 |
| Dan Chowdhury | d****n@g****m | 2 |
| Herve Nicol | h****l@g****m | 2 |
| Marcelo Trylesinski | m****e@g****m | 2 |
| Nehal J Wani | n****1@g****m | 2 |
| RaananHadar | r****r@g****m | 2 |
| Rolando Espinoza | r****4@g****m | 2 |
| Alexander Shadchin | a****n@g****m | 1 |
| and 36 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 28
- Total pull requests: 172
- Average time to close issues: 4 months
- Average time to close pull requests: 24 days
- Total issue authors: 24
- Total pull request authors: 26
- Average comments per issue: 2.18
- Average comments per pull request: 1.13
- Merged pull requests: 135
- Bot issues: 0
- Bot pull requests: 6
Past Year
- Issues: 6
- Pull requests: 12
- Average time to close issues: about 2 months
- Average time to close pull requests: 6 days
- Issue authors: 6
- Pull request authors: 8
- Average comments per issue: 0.67
- Average comments per pull request: 1.67
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- danieldk (2)
- sizhky (2)
- connorbrinton (2)
- vitaly-d (1)
- knevan (1)
- Manamama (1)
- willfrey (1)
- nikita-galileo (1)
- rakovskij-stanislav (1)
- danielhallmann (1)
- khmyznikov (1)
- AmitMY (1)
- ascillitoe (1)
- znadrich-qf (1)
- frobnitzem (1)
Pull Request Authors
- danieldk (65)
- adrianeboyd (56)
- honnibal (12)
- svlandeg (9)
- kadarakos (8)
- github-actions[bot] (6)
- shadeMe (4)
- essenmitsosse (4)
- shadchin (3)
- a-detiste (2)
- davispuh (2)
- Atlogit (2)
- J08nY (2)
- richardpaulhudson (2)
- BLKSerene (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- tiangolo/issue-manager 0.2.1 composite
- node 11.15.0 build
- 1723 dependencies
- babel-cli ^6.26.0 development
- babel-core ^6.26.0 development
- babel-plugin-transform-class-properties ^6.24.1 development
- babel-plugin-transform-decorators-legacy ^1.3.4 development
- babel-plugin-transform-object-rest-spread ^6.26.0 development
- babel-plugin-transform-react-remove-prop-types ^0.4.13 development
- babel-preset-env ^1.6.1 development
- babel-preset-react ^6.24.1 development
- json5 ^2.1.0 development
- md-attr-parser ^1.2.1 development
- prettier ^1.16.4 development
- unist-util-remove ^1.0.3 development
- unist-util-visit ^1.4.0 development
- @tippy.js/react ^2.2.2
- autoprefixer ^10.4.13
- classnames ^2.2.6
- gatsby ^4.18.2
- gatsby-image ^2.11.0
- gatsby-plugin-google-analytics ^4.25.0
- gatsby-plugin-manifest ^4.25.0
- gatsby-plugin-offline ^5.25.0
- gatsby-plugin-plausible ^0.0.7
- gatsby-plugin-react-helmet ^5.25.0
- gatsby-plugin-react-svg ^3.3.0
- gatsby-plugin-remove-trailing-slashes ^4.19.0
- gatsby-plugin-sass ^5.25.0
- gatsby-plugin-sass-resources ^3.0.1
- gatsby-plugin-sharp ^4.25.0
- gatsby-plugin-sitemap ^5.25.0
- gatsby-remark-copy-linked-files ^5.25.0
- gatsby-remark-images ^6.25.0
- gatsby-remark-prismjs ^6.25.0
- gatsby-remark-smartypants ^5.25.0
- gatsby-remark-unwrap-images ^1.0.2
- gatsby-source-filesystem ^4.25.0
- gatsby-transformer-remark ^5.25.1
- gatsby-transformer-sharp ^4.25.0
- html-to-react ^1.3.4
- parse-numeric-range 0.0.2
- prismjs ^1.15.0
- react ^16.8.2
- react-dom ^16.8.2
- react-helmet ^5.2.0
- react-jss ^8.6.1
- rehype-react ^3.1.0
- remark-react ^5.0.1
- slugify ^1.3.6
- black >=22.0,<23.0
- blis >=0.7.8,<0.8.0
- catalogue >=2.0.4,<2.1.0
- confection >=0.0.1,<1.0.0
- contextvars >=2.4,<3
- coverage >=5.0.0,<8.0.0
- cymem >=2.0.2,<2.1.0
- cython >=0.25.0,<3.0
- dataclasses >=0.6,<1.0
- flake8 >=3.5.0,<3.6.0
- hypothesis >=3.27.0,<7.0.0
- importlib_resources *
- ipykernel >=5.1.4,<5.2.0
- ml_datasets >=0.2.0,<0.3.0
- mock >=2.0.0,<3.0.0
- murmurhash >=1.0.2,<1.1.0
- mypy >=0.990,<0.1000
- nbconvert >=5.6.1,<6.2.0
- nbformat >=5.0.4,<5.2.0
- numpy >=1.15.0
- packaging >=20.0
- pathy >=0.3.5
- preshed >=3.0.2,<3.1.0
- pydantic >=1.7.4,
- pytest >=5.2.0,
- pytest-cov >=2.7.0,<5.0.0
- srsly >=2.4.0,<3.0.0
- types-contextvars >=0.1.2
- types-dataclasses >=0.1.3
- types-mock >=0.1.1
- typing_extensions >=3.7.4.1,<4.5.0
- wasabi >=0.8.1,<1.2.0
- actions/checkout v3 composite
- actions/setup-python v4 composite