Now I'm wondering why JS is so unpopular for deep learning, especially compared to Python. For deep learning there all the usual benefits of using JS, e.g.:
- easy to learn
- huge community
- flexible about paradigms
- write code once, run anywhere (especially useful for training/deploying models as well as cool applications like federated learning on client devices).
Plus, compared to Python there's the huge added benefit of proper static types and the rich tooling of TypeScript. I know Python3 has type hints, but it's a really horrible experience compared to any proper typed language. Playing around with TensorFlow.js I've found it catches plenty of mistakes that would require me to read and understand a bunch of code in Python. But with VSCode plugins, I just hover over a variable and it tells me what I'm doing wrong immediately.
So why is no-one really using this? Is it just the momentum of the Python deep learning community? Have I missed some huge downside? Is there a thriving underground JS deep learning community I've not been initiated into?
You can with Node.js, e.g. https://nodejs.org/dist/latest-v12.x/docs/api/n-api.html
TensorFlow.js for Node.js is just a nice way to interface with a native backend, just like the Python library. In the browser they use WASM rather than pure JS for better performance. But you're right that it's not quite as easy as Python.
Yeah, sorry, I meant in particular the convenience I've seen in the Python world. I know that you can call native code from Node.js, but the whole ecosystem isn't really set up to do that, and the few times I've experimented with it it seemed quite clunky to me, but I really haven't looked very much, so might totally be wrong. My guess is that the ecosystem is also just a lot younger, so even if you can do these things reliably now, you probably couldn't a few years ago.
And yeah, using WASM you can get something similar going, though my guess is WASM is still going to be substantially slower than native code, at least for now.