I’ve been playing with the idea of building a generative AI app (images/video). Part of me really wants to use Elixir because I love how it handles concurrency and real-time stuff. But I keep wondering… would Elixir just end up being the orchestrator while Python does the actual AI heavy lifting? Or is Nx/Axon good enough now to lean more into Elixir for the ML side too?
Anyone here tried going down this path? Curious what worked (or didn’t).
At the end of the day whether it’s Elixir or Python, the actual heavy lifting is done below that in C/C++/CUDA/…
So I think the first question is whether you really want to run the models yourself or just use an API which would probably be way cheaper, given that you’ll need a GPU to do image/video generation if you don’t want to wait 10 minutes for a single image. If you use an API for the generative AI part, it doesn’t matter if you write your app in Elixir or Python, so use Elixir and have some fun
If you want to run the model yourself, Axon/Nx is definitely good enough to run it because it makes use of the same underlying libraries as the Python world (as the most developed backend for Nx is xla via exla library, I think it lacks a bit behind the cutting edge stuff from pytorch. I’m not sure though and I don’t think it would really matter for you’re use case). The bigger issue you’ll run into is that you need an implementation in Elixir for the model you want to run. And that’s in the bumblebee library, which can’t keep up with all the new models developed in Python. If the model is not implemented yet and you’re interested in how all of this works under the hood, you can implement it and open a PR
The easier way out here is to use the pythonx library, run the model from there and as soon as you or someone else implemented it you can switch to Nx