Fable port
See original GitHub issueThis is somewhat of an elevator pitch referring to the profit meme in https://github.com/DiffSharp/DiffSharp/issues/69#issuecomment-586476537
My proposal for the ????
part is to consider Fable integration as a possible driver for that.
Why?
When I was learning neural networks a few years ago, I remember playing a lot with Andrej Karpathy’s https://cs.stanford.edu/people/karpathy/convnetjs/ deep-learning library in Javascript.
The main reason why I actually spent time playing with slow Javascript backpropagation rather than training neural networks in Python on real Nvidia GPU are a) it’s a great learning and teaching tool, b) it’s extremely accessible (all you need is browser, no install necessary), c) and most importantly, it’s interactive and extremely involving.
Another argument effective just recently is that the GPUs are nowadays accessible also in browsers through WebGL.
By far the coolest thing is that in browser the state of neural network can easily be visualized in real time, which makes it very addictive: you change some parameters, choose what to visualize, press Run and see the effects of your changes as things progress… Then rinse and repeat. It’s easy to spend heaps of time having fun with that.
Scroll down for some images…
Rendering such images takes quite some effort in Python and you still don’t seem them as things progress, whereas on browser, all of this is accessible through a few lines of code. You can easily pick any layer of neural network to visualize. In real time.
While JS frameworks like tensorflow.js do exist, F# has unique position to target both browser and backend with the same language (Tensorflow has different implementations for Python and JS). Anything you learn or write in browser is transferable to backend.
And vice versa. Models trained in backend are easily transferable to frontend, which also makes it a good business proposition.
And you squint and it looks like python.
So the idea is to use one of JS WebGL tensor libraries as an additional DiffSharp Backend. I don’t think that would be hard to do (I’d be willing to invest time into it).
The bigger obstacle is that Fable is lacking support for multidimensional arrays. I’ve tried to look into that already, but it will require someone with more knowledge on Fable-compiler internals to work on that.
So what’s really missing is to find a way to somehow invite Fable people into this story and ask them to help us out with multidimensional arrays.
.
These are sample images: This is what you don’t get to see in real time, if you train your networks in Python.
https://blog.fastforwardlabs.com/2016/08/12/introducing-variational-autoencoders-in-prose-and.html
http://kennycason.com/posts/2018-05-04-deep-autoencoder-kotlin.html
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Some technical notes regarding Fable.
Fable or WebSharper cross-compile would be somewhat intrusive - both in the code and in the testing.
Because of this, the best approach technically would probably be for someone to maintain a downstream fork or branch (it doesn’t much matter which) which cross-compiles the Reference implementation and testing, with the Torch backend removed (a “haircut”), under the full knowledge that there will be considerable churn in the core implementation.
That’s the way that the Fable port of FSharp.Compiler.Service was created and is maintained at the moment, and indeed FCS was itself created as a fork+haircut of the core F# tooling.
This can be an effective maintenance strategy but requires regular integration, e.g. this. It’s sometimes possible to automate this integration
Normally it’s not realistic to integrate the necessary changes back even under
#if
because of the engineering complexity induced at this stage.@gbaydin and myself aren’t at the point where we could do this but if @pkese or someone else would like to work on it (as a downstream fork+haircut) I’m sure we can cooperate in a similar way to happened for FCS
Perhaps you wouldn’t need a multidimensional array implementation in Fable, if they already support 1d arrays. DiffSharp reference backend implements multidimensional arrays (tensors) using simple arrays (like a 1d data array and a 1d shape array). The code does use some 2d arrays in parts like slicing however.