liquidcarrot / carrot

🥕 Evolutionary Neural Networks in JavaScript
https://liquidcarrot.io/carrot/
MIT License
293 stars 34 forks source link

GPU.js Adoption #30

Open christianechevarria opened 5 years ago

christianechevarria commented 5 years ago

Screenshot 2019-04-24 at 7 41 34 PM

dan-ryan commented 5 years ago

Crazy suggestion, you could build on top of Tensorflow.js like what Ml5.js has done. You would get GPU browser support, and fast Node.js support (with CUDA). But that would be a large rewrite :)

luiscarbonell commented 5 years ago

@dan-ryan I'm crazy enough to explore the possibility; but I really would like to keep the API as simple as in-humanely possible (i.e. "teach a year old, in 20 minutes").

I would love to create "plug-gable" "firmware" layer where we could support different computational unit (e.g. CPU, GPU, TPU, etc.) automatically without off-loading the "figure it out" part on someone.

I'll have to take some time next week to really tackle some solid architect-ing; but I would love to, ideally, be a zero dependency library with just some simple C++ bindings to CUDA core support.

The phrase "strong defaults" comes to mind.

I'll have to give this a deeper look - maybe do it in parts, or on a contiguous roadmap (avoid Angular v1 to v2 scenario).

dan-ryan commented 5 years ago

Well since you said you were crazy enough to explore... :)

Tensorflow seems to be the standard low-level neuro-network library on the desktop. Tensorflow.js has only been around a year before that it was called DeepLearn.js. I see Tensorflow.js becoming the standard on browsers. It's pushed by Google and they have the money. It's quite difficult to learn and they mention they won't do anything high level like neuro-evolution. Ml5.js is built on top of Tensorflow.js and makes everything easy, but they are only focused on already trained models, like image classification. While awesome for images and videos, it is limited on what you can do.

Carrot could be rewritten on top of Tensorflow.js like what M15.js has done, and we would get all the low-level advantages with that. The strengths Carrot could have that it has a simple API and we support high-level algorithms.

There are also many other libraries that would give us GPU support. Synaptic 2.0 discussions brought up a lot of ideas: https://github.com/cazala/synaptic/issues/140

dan-ryan commented 5 years ago

Neataptic had this issue with ideas: https://github.com/wagenaartje/neataptic/issues/49

robertleeplummerjr commented 5 years ago

Guys, GPU.js now runs on node, and I believe v2 rc14 will be out soon. Perhaps tomorrow.

luiscarbonell commented 5 years ago

@robertleeplummerjr I'm playing around with gpu.js right now - fun stuff!

All good so far - I did note a small kink (https://github.com/gpujs/gpu.js/issues/478), but otherwise working like a charm right now. I'll keep you posted.

robertleeplummerjr commented 5 years ago

How is implementation going?

luiscarbonell commented 5 years ago

Really well so far; but I hit an impasse (unrelated).

We've been trying to clean up the code base, standardize it, and write test to clean a little bit of the technical debt we were carrying and help speed up the feature unit economics on the project.

I'm waiting to get some motherboards for a handful of NVIDIA Tesla v100's that I have at home so I can a better testing environment than simulating a GPU - it keeps eating up my Chromebook (🔥).

I'm talking to a friend of mine in a small IT startup right now who has a few laying around - so I'll like "Frankenstein" a rig for model development and testing grounds for gpu.js adoption.

In the meantime, I'm going to focus on adding streaming to the library.

robertleeplummerjr commented 5 years ago

Cool! If you need a sponsored + hosted GPU's, I know a guy...

luiscarbonell commented 5 years ago

External Response

That would be super cool! ...email (luis@liquidcarrot.io)?

Inner Thoughts

robertleeplummerjr commented 5 years ago

Details sent.

robertleeplummerjr commented 4 years ago

For those following this, things with GPU sponsor have been going nicely on all fronts.

luiscarbonell commented 4 years ago

@robertleeplummerjr The introduction was awesome! 👌 Will begin testing as soon as we get setup.

robertleeplummerjr commented 4 years ago

What I really need from you and others is benchmark data, if you have a chance. Also if you find any bugs.

luiscarbonell commented 4 years ago

I'll shoot you over a more detailed report later, but "off-the-cuff" GPU.js starts outpacing CPU on my modified Chromebok (4 Core - 1.4GHz) around 1300 paramaters (i.e matrix multiplications of at least 1300x1 * 1300x1) - after that it scales REALLY well. But creating the kernel has some overhead initially - which totally makes sense.

I haven't really found any strong bugs yet more like "little quirks", but I'll shoot them over to your issues threads as I start noting them a little more concretely. 👍

robertleeplummerjr commented 4 years ago

Ty! Also, video element will be a valid input for GPU.js v2. Which will be released today.