from Hacker News

Show HN: Thinc, a new deep learning library by the makers of spaCy and FastAPI

by tiangolo on 1/28/20, 9:48 PM with 17 comments

  • by syllogism on 1/28/20, 10:17 PM

    I've been working on various versions of Thinc for a long time --- it's always been the name for the machine learning code powering spaCy. But previous versions really weren't worth using for other developers, and so I never wanted to advertise the library as something people should use.

    The new version's been mostly rewritten, and this time, my feelings are different :). There's honestly a lot here that DL people should find interesting, even if you're not really looking for new tools atm (which is very understandable).

    If you first learned deep learning by using PyTorch and TensorFlow, you might find Thinc to be an interestingly different perspective. The backpropagation mechanics are much more exposed, but functional programming means managing the gradients is little trouble.

    It's also a great way to try out Python's new type annotation features. We designed the library to use type annotations, and have pretty detailed support for numpy semantics.

    Other nice features include the config system and the wrappers system: you can use models from external libraries as part of a network, and wire different frameworks together. The idea behind Thinc is to work in conjunction with current DL tooling. We want to avoid providing our own optimised engine, making the library much more lightweight and compatible.

  • by ZeroCool2u on 1/29/20, 3:20 AM

    Damn, SpaCy and FastAPI, not to mention Prodigy, make up a huge percentage of our teams development stack. It took us a while to even realize that tiangolo and syllogism work together, but there was definitely a moment of slack jawedness across the team when this became clear.

    Having built SpaCy from source, Thinc was something I've dealt with in passing before. Needed to look over some of it's source for debugging briefly, but never paid a whole lot of attention to it. This is basically a complete overhaul and it's beautiful.

    It blows my mind how productive this team is. ExplosionAI and the SpaCy compatible model implementations from HuggingFace are basically responsible for a _huge_ amount of practical progress in making modern NLP models quickly and easily accessible. Now a general development framework, that frankly makes TF Keras and PyTorch pale in comparison wrt simplicity, is absolutely astounding. Congrats everyone on the release!

    Now I need to go back to packing up my apartment and ponder how I'll ever approach this velocity and quality.

  • by tiangolo on 1/28/20, 10:11 PM

    FastAPI creator here.

    If you've used FastAPI you'll probably like Thinc.

    It uses Python type hints extensively and even includes a Mypy plugin. So, you'll get nice and clear errors right in your editor for many operations that before were Numpy/Tensor "black magic". All before even running your code.

    And you can wrap TensorFlow, PyTorch, and MXNet with it, mix them with Thinc layers, etc.

  • by ipsum2 on 1/29/20, 3:00 AM

    Interesting project! How does the type system work with variadic types and arbitrary tensor manipulations? e.g. a function transforms tensor[A, B] -> tensor[A].
  • by guybedo on 1/29/20, 2:20 AM

    how does it compare to Tensorflow, Keras, PyTorch ?
  • by kmbriedis on 1/29/20, 7:27 AM

    So no custom CUDA kernels, just CuPy? Isn't that a performance issue? (Based on installation notes)
  • by m0zg on 1/29/20, 12:24 PM

    I must be missing something but this looks more complicated and confusing than plain PyTorch.