HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
explosion
thinc
Python2017–2023
explosion / thinc

thinc

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

6Distinct people
11Mentions
0Explicit recommenders
2.9KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

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

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2017-10-05 22:49:58 UTC to 2023-09-29 06:35:55 UTC.

01232017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC312
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC312
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC101
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

What Hacker News says

11 sources
Agree, though I wouldn’t call PyTorch close to a drop-in for NumPy either, there are quite some mismatches in their APIs. CuPy is the drop-in. Excepting some corner cases, you can use the same code for both. E.g. Thinc’s ops work with both NumPy and CuPy: https://github.com/explosion/thinc/blob/master/thinc/backend... Though I guess the question is why one would still use NumPy when there are good libraries for CPU and GPU. Maybe for interop with other libraries, but DLPack works pretty well for converting arrays.
In JAX – NumPy on the CPU, GPU, and TPU
The best answer is, "with some difficulty". I've written a bit about the struggles here: https://thinc.ai/docs/usage-type-checking#model-types There are basically two approaches, TypeVar and overload. You probably want TyepVar if you have exactly that sort of situations, but there's a lot about type vars I still don't understand, and the docs say almost nothing. The problem is the responsibility is kind of split in two places: the Python typing module doesn't really take any responsibility for usage, and mypy sees it as not mypy-specific, so neither describes it very well. Our current solution is to avoid being fully variadic in the tensor type, and instead have a limited number of subclasses. This allows us to get by with overload, because we can enumerate out the set of argument-to-return mappings. This is especially important for the n
Read the rest
umpy API where you often have to overload on the types and values of other arguments, e.g. if you pass axis=(0, 1), you'll get a different rank of tensor back than if you had written axis=-1. You can see the gory details of how I've done the numpy types here: https://github.com/explosion/thinc/blob/master/thinc/types.p...
In Show HN: Thinc, a new deep learning library by the makers of spaCy and FastAPI
You can write custom CUDA kernels, and I've written a few to support operations over our ragged format. Actually Thinc makes it pretty easy to optimise a specific bit of code with a custom op...cupy's fused decorator can also work well in some situations. What you don't get is the compile-time auto-optimisation. Like, there's no asynchronous dispatch like you would get from PyTorch. If you write a chunk of operations as just cupy maths, and then write the same thing in PyTorch and use the PyTorch wrapper, you can expect the PyTorch one to perform better. You would also need to write the backprop callback for the cupy maths you did. Sometimes you might find optimisations PyTorch doesn't though, especially around speed vs memory trade-offs. Part of the philosophy and difference between this and other frameworks is that we do not do any comp
Read the rest
ilation or trickery of any sort: what you write is what gets executed. Obviously this is slower a lot of the time, but it means we can play well with others --- we're not wrestling for control of more of the graph so we can make more optimisations, and we're not limiting the hand optimisations you can do for custom situations. Here's an example of how I've wrapped CUDA kernels, using Cupy's RawKernel feature. Most people do these as strings within Python source, but I find that super ugly. I like to keep the cuda source in .cu files, and then read in the file to compile it. * The CUDA kernels: https://github.com/explosion/thinc/blob/master/thinc/backend... * The code that calls cupy.RawKernel and the wrapping functions: https://github.com/explosion/thinc/blob/master/thinc/backend... * The wrappers are called by the CupyOps object: https://github.com/explosion/thinc/blob/master/thinc/backend... . This object has the same API across backends, with some functions redefined with backend-specific implementations. In the NumpyOps object, I instead call into custom Cython code. My CUDA skills aren't great, so I'm sure there are improvements that could be made. I'd welcome suggestions if anyone has them.
In Show HN: Thinc, a new deep learning library by the makers of spaCy and FastAPI
I did a linguistics degree before doing my computational linguistics PhD 2005-2010. In Australia we don't do any graduate coursework, so the last maths class I took was when I was 15 or 16. I'm now pretty good at these things. You can see my work here: https://explosion.ai You might be interested in the machine learning library I wrote for spaCy: https://github.com/explosion/thinc . The backward propagation can be understood quite simply with callbacks. The main problem I had, and I think you're having, is that the notation around calculus is just hopeless. It's even worse when you're trying to map between the equations and backpropagation, because what you need is slightly different. I also find the notations for functions really bad. The other thing you need to get used to are the ways linear algebra overload the operators. This is just
Read the rest
data, not concepts. Personally I find it much easier to just work in the Einstein summation: https://obilaniu6266h16.wordpress.com/2016/02/04/einstein-su... . Once it's debugged, you can translate into faster calls to numpy.tensordot. Don't go back to school. School's fucked. It'll take you three years to do about 200 hours of learning. Hiring a tutor would be vastly better if you need some help.
In Fewer than 10k people have the skills necessary for AI research?
This is amazing -- we have a small mountain of Cython code, and almost everything is working out of the box! Tests failing: * https://github.com/explosion/spaCy Confirmed working: * https://github.com/explosion/thinc * https://github.com/explosion/preshed * https://github.com/explosion/cymem * https://github.com/explosion/murmurhash I doubt spaCy will ever be faster on PyPy (the neural network library Thinc is currently 50% slower). It'd still be really great to get it running, so people who benefit from PyPy for other parts of their stack don't have to manage two Python environments.
In PyPy v5.9 Released

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.