5 ms·
Elixir and Machine Learning: Nx v0.1 released
- josevalim 5y agoHi everyone, author here! I will be glad to answer any questions. :)
- lvass 5y agoI just want to thank you for your incredible work. I'm a fellow countryman migrating a Python program that fetches financial data from a large amount of sources, that's become very hard to maintain, to Elixir. The BEAM fits my use case perfectly, and Elixir has been an absolute joy to work with and debug.
- losvedir 5y agoVery impressive library! Is it still in the developmental stage, or do you know of anyone using it for real yet? Also, I love livebook! I keep a tab with it open and it has replaced my use of iex. Can you talk a little bit about how you decided to embark on building that, too? An ML library and framework is a big enough job already, how did you decide to add Livebook to the list?
- josevalim 5y agoThis release means we are getting closer to prod usage but Nx requires one of the existing compilers/backends to shine. So I am hoping we will see production uses once we officially release Torchx/EXLA packages too. --- Curiously, I had two ideas for the name Livebook: 1. An interactive book to teach LiveView. LiveView is a new approach for developing web apps and I thought it could be worth exploring different non-traditional ways of teaching it too! 2. Livebook as code notebooks (what we got!) It just feels a great fit for the platform, considering Phoenix, LiveView, Distributed Erlang, etc. So why not? :) And I am curious to see if and how we can contribute new ideas to the already extensive ecosystem of code notebooks!
- GaltMidas 5y agoThank you so much for all of this great work. What was the inspiration for this direction? Was it a personal itch? Or something else?
- josevalim 5y agoIn general notes, it is an effort to bring more use cases to Elixir, the Erlang VM, and the ecosystem. But it is an area I have been interested on (back in 2009 my master thesis was actually within Machine Learning). When I met Sean (through the Genetic Algorithms in Elixir book), our interests aligned and we started working on it!
- alberth 5y agoOff-topic: hi Jose, what's your expectation on how much more raw performant Erlang can become in the next 1-2 years? PHP ~3x in performance from 5.x to 7.x. LuaJIT is even faster over vanilla Lua. There were multiple attempts at creating an Erlang JIT for well over a decade now and last year BeamAsm was released but in everyday use it seems to net about a 10-15% boast. I ask because it'd be great if we didn't have to create so many Rust NIFs in order to address Erlang raw slowness. Curious what your take is on speeding up raw Erlang (please note, I'm not talking about concurrency & I do truly love Exilir/Erlang/OTP)
- josevalim 5y agoI am not informed enough to give actual estimates. :) Although your estimates for JIT improvements seem low on my experience. Compilation times are consistently half of what they were before and test suites range between 33% to 50% faster. Even Whatsapp reported server efficiency increased by 25% and many other factors are likely at play there (source: https://twitter.com/wcathcart/status/1385253969522413568 https://twitter.com/wcathcart/status/1385253969522413568). I _assume_ we will continue seeing improvements on this front, especially if at some point we start doing cross module optimizations!
- alberth 5y agoThanks! Hope so too. I feel like raw performance is the #1 thing from greater adoption of the echo system.
- ashton314 5y agoYou sir, are a legend. I was particularly delighted to see how you built `defn` on top of existing metaprogramming functionality. This kind of thing has lead me to think of Elixir as a Lisp in Ruby's clothing running on the BEAM. :) I hope that's not too inaccurate. Were there any delightful "aha!" moments you got while building this?
- b5n 5y agoYou may be interested in LFE (lisp flavored erlang). https://lfe.io/ https://lfe.io/
- sodapopcan 5y agoI think that is pretty accurate. If you forgo the `do/end` syntactic sugar, Elixir sorta kinda starts to almost kinda sorta resemble S expressions: defmodule Foo, do: (def foo(bar), do: bar; def bar(baz), do: baz)
- sodez117 5y agoHi José, not Nx related but would you consider adding a RSS feed to the Dashbit blog?
- josevalim 5y agoI believe we have one. Does this address work for you? https://dashbit.co/feed https://dashbit.co/feed
- ksec 5y agoAre there any specific advantage that Elixir being on BEAM VM brings to Machine Learning and Data Science? I am assuming BEAM VM's actor model fits well with the GPU / Tensor usage ? ( I have zero knowledge on ML and Data Science ) Personally I think this is a great move from Elixir community and especially coming directly from the creator. Some people may be dismissive ( as with at least half of HN ) But I see this with Ruby where there is a chicken and egg problem. The community stuck with Web or Rails Development only. And no one has incentive to kickstart the languages ecosystem in different directions. So instead of Elixir being another language for Web / Phoenix, it could now ( or in the future ) be used as ML with some level of official support.
- outlog 5y agoamazing work ♥! any idea on M1 gpu support? (know it's mostly an upstream issue) excited about "real"/intensive ML workflows locally..
- josevalim 5y agoYou are correct. Currently we are waiting for the issue to be tackled upstream (both on LibTorch and Google's XLA). Someone could also implement a specific Nx-backend for Apple. It should actually be fun but not high priority at the moment.
- dpeck 5y agoI’ll plug some to Jose Valim’s Advent of Code solutions that included NX approaches alongside “standard” Elixir ones for some of the days. It was good to see and get some ideas of what’s possible. https://github.com/josevalim/aoc https://github.com/josevalim/aoc
- jmknoll 5y agoAdding to this, Jose was also streaming his solutions on Twitch https://www.twitch.tv/josevalim/videos https://www.twitch.tv/josevalim/videos I was learning Elixir through advent of code, and this was an invaluable resource for getting my head around an more functional (or Elixir-y?) style of problem-solving.
- engineerio 5y agoI love Jose Valim's work (even back to the inherited resources days!), but with a very popular Nx already out there (nx.dev a dominant player in the monorepo space) this naming just adds to confusion. Nx is on the thoughtworks radar so not exactly unknown: https://www.thoughtworks.com/radar/tools/nx https://www.thoughtworks.com/radar/tools/nx I know for a fact it has already confused elixir developers who were looking for an elixir plugin for Nx (the monorepo tool).
- ch4s3 5y agoWell there isn't an Nx.dev plugin for Elixir, is there? Nx for Elixir is a nice shorthand for Numerical Elixir. Nx.dev just looks like a consulting company jumping on a short domain when the .dev TLD became available and then using it for a project later. The nx.dev site was only launched in 2019, and then as an Angular dev tool, and as an Elixir dev I hadn't heard of it until after Nx elixir existed, which seems to have started some time in mid to late 2020. [1]https://web.archive.org/web/20190501153325/https://nx.dev/ https://web.archive.org/web/20190501153325/https://nx.dev/
- engineerio 5y agothat's not really correct. nx is from 2017: https://github.com/nrwl/nx/graphs/contributors https://github.com/nrwl/nx/graphs/contributors . might even be longer because I think the company is nrwl. the nx.dev site is just what I'm pointing to, dunno what url it was before that. no idea if there was an elixir plugin for nx (easy enough to integrate https://www.youtube.com/watch?v=IRIXPTIKTmA&t=6s https://www.youtube.com/watch?v=IRIXPTIKTmA&t=6s) but I'd have no hope of finding it now . it's totally not the worst thing that nx was also the name Valim chose (I have no investment in to tool or company myself), but it is bad for both projects.
- ch4s3 5y agoMy point was that it wouldn't have been on the radar for anyone in Elixir land, and having a name clash with what looks to be a JS focused tool isn't that big a deal when they're in really different domains.
- anton_ai 5y agoWhat's the goal here? It seems like they want to make elixir the new AI language, but why should I go from python to Elixir? I know it seems a dumb question but I can't find in the link any reason why. I really like python but at the same time I would like to have something faster but also with pandas, numpy, statsmodel and so on
- bullfightonmars 5y agoThis a parallel and independent ecosystem for numerical computing with equivalent libraries: * pandas - explorer * numpy - nx * statsmodel - Not sure this exists yet The article answers this pretty well. However, our goals are also to: * make Elixir a suitable platform for new Machine Learning developments * fully leverage the power provided by the platform Elixir runs on, the Erlang VM * provide consistency and stability, especially when working on a domain that is still actively evolving For those reasons, we chose to invest on Nx as its own foundation, agnostic to any particular framework. The road is definitely longer but we also believe the pay-off will be higher too!
- hosh 5y agoI think right now, this is for people who already know and need the advantages of Erlang/Elixir and want to be able to do numerical computing without having to resort to a NIF or ports. Numerical computing has been one of the big weaknesses with the BEAM platform, even though it is among the first things people think about when they find out about how BEAM does concurrency. I can tell you that many Elixir developers are quite excited about this. It is definitely scratching an itch. I don't know how this is emerging. If I take a stab at it, BEAM/OTP/Erlang/Elixir is very good at coordinating among many concurrent processes as well as handling failures that come with it. There really isn't any other language platform that does that as well, including Python. (Although there is interest in recreating those advantages in Rust). The distributed computing is built on top of those concurrency primitives. So when one thinks about adding numerical computing into the mix, I think of: - Broadway (an Elixir library) that handles workflows from unreliable data sources. It is already in production use to handle massive, distributed web scraping operations, so embedding a data transform in there with numeric computing will have good synergies - IoT applications, both at the edge with Nerves, and with the command/control for IoT. Each of the IoT devices are unreliable (power and network), and OTP already has great facility for that. Being able to do numeric computing at the edge is a thing.
- throway453sde 5y agoAs a language are there any parallels between "Wolfram Mathematica" and "Elixir", since both talk about pattern match, search and replace in the context of evaluation a lot.
- mikl 5y agoAmazing work, you guys rock.