5 ms·
> Unless there is a library you can't live without or rewrite There are quite a few of these. I couldn't do any of my ML work in a language other than Python o
by MiroF 6y ago
> Unless there is a library you can't live without or rewrite
There are quite a few of these. I couldn't do any of my ML work in a language other than Python or C++.
Calling what Go has a "type system" is a stretch IMO.
- elcritch 6y agoI’ve been toying with Nim lately to wrap C++ ML libraries, which gives a nice Pythonic syntax but compiles to a binary wrapping the ML lib. Seems to work well for Torch. There's a nice wrapper library nimtorch for Nim [1]. It's a bit out of date bit would be easy to update, probably. Well easier than bundling pytorch on an embedded device. Even manually wrapping the needed C++ libraries isn't that hard in Nim, IMHO. Overall looking at Python deployment story after using Elixir for the past couple of years makes me cringe a bit. Rather I have no idea how to do it. Deterministic versions, lock files, and container/tarball (or binary) support seems a given in 2020. 1: https://medium.com/@giovanni_94706/introducing-nimtorch-b8b0fa749464 https://medium.com/@giovanni_94706/introducing-nimtorch-b8b0...
- MiroF 6y ago> Well easier than bundling pytorch on an embedded device. I don't follow - wouldn't nimtorch also require bundling pytorch on an embedded device?
- elcritch 6y agoYes and no, Pytorch (like Tensorflow for Python) is just a wrapper around a core C++ library. So you can compile a binary from C++ linking to the pytorch libs without including Python. Technically it's pytorch, but without Python and Python dependency management which is way simpler. Nimtorch let's you wrap the C++ api of pytorch with nice Pythonic looking code, a GC, but using only C++ and possibly statically linked. Win win. See: https://pytorch.org/tutorials/advanced/cpp_frontend.html https://pytorch.org/tutorials/advanced/cpp_frontend.html
- MiroF 6y agoYes I understand pytorch quite well - I was merely confused because I consider the C++ library to still be pytorch. I don't see the advantage of this setup over just loading a torchscript model in C++ or any other static language. A full set of bindings seems unnecessary unless you need to train in nim.
- elcritch 6y agoTrue, my terminology was a bit outdated as I keep thinking of pytorch as just the Python wrapper on libtorch. That's not really true. I prefer to avoid Python nowadays due to the pain of dependency management, a nice as this article is don't care to learn about Poetry. So training in pure C++ (or better Nim) is my preferred setup. Keeping a similar build setup for both training and deployment saves a lot of headaches which is why the nimtorch interface is handy even if it's not as full featured/up to date. Now I'm only deploying a very simple NN without much need for experimentation.