8 ms·
Fast.ai and why Python is not the future of ML with Jeremy Howard
- cheriot 6y agotldr; Jeremy Howard says python will always be calling out to something else that's faster and more parallel. Writing fast python has too much cognitive overhead. He hopes Julia catches on because it's Julia all the way down.
- linkdd 6y agoI think that's one of the strength of Python: - implement your work intensive logic with the adapted tools - glue everything together with Python
- lmm 6y agoI used to think that until I found Scala. It's easier than writing Python - I can write pretty much the same thing as I would in Python, but I have a more complete IDE and I can ask it what the types of things are. I'd never want to use a Java/C++-style language for exploratory programming, but it turns out not all reasonable-performance languages are like that.
- fxtentacle 6y agoI actually do lots of exploration with C++ and ReSharper. There's excellent C++ libraries for everything these days. And cmake has made them easy to install.
- lmm 6y agoI really don't see it. No first-class REPL and REPLs/IDEs will always be limited due to the ecosystem relying on macros; no proper dependency manager and certainly nothing comparable to maven central/CPAN/etc. And the language is missing even the most basic support for sum types, making its type system painfully restrictive.
- pjmlp 6y agoconan and vcpkg are the proper dependency management. Macros are less of an issue with modern IDEs, and that is hardly any different from any other language with macro support, including Scala.
- gilbertmpanga12 6y agoI think you're trying to oversell here, Scala is bloated with lots of paradigms and lots of features. It's pretty hard to know what to use. Python in most ML frameworks is just a frontend, other beefy stuff gets processed by c++ or c
- lmm 6y ago> Scala is bloated with lots of paradigms and lots of features. It's pretty hard to know what to use. It's a flexible language, but I wouldn't say bloated - there actually aren't so many language-level features, but the features there are are very general. Some parts are simpler, e.g. in Python I struggle to remember which method you have to define to overload the * operator, whereas in Scala you just define a method called * . But I'd agree that there are a bunch of overcomplicated frameworks that can be pretty confusing - it's not always an easy language to get started with. But I stand by the statement that you can write Python-like code in it, at least once you know what you're doing. > Python in most ML frameworks is just a frontend, other beefy stuff gets processed by c++ or c Right, and that introduces a bunch of overhead and possibilities for weird errors - e.g. when you hit a bug in a library you pretty much have to learn how to debug C. In Python the benefits are worth it, but there's undeniably an overhead - if you could use the same language top-to-bottom but still have all the nice things Python gives you, that would be a much nicer way to work.
- pjmlp 6y agoExcept, there are several languages as dynamic as Python that don't need "adapted tools", because they also offer AOT/JIT compilers in the same package.
- tasubotadas 6y agoHow many times you've tried glueing C++/C code with Python? It's a pain in the ass, and there is no need to pretend that it's great just because Python sucks (performance wise).
- Nimitz14 6y agoEver heard of pybind11? It's easy as fuck.
- ummonk 6y agoHow is that a strength? Why should you need to implement the work intensive logic in one language and glue it together in another?
- evgen 6y agoThe standard reply to this that has been repeated over and over is that for 99.99999% of the people performing such a task they are not going to implement the work intensive logic, they are going to use a well-tested and well-supported library that is built and maintained by domain experts.
- pjmlp 6y agoWhich can have bindings to every language in existence, thus diminishing even more the role of Python.
- linkdd 6y agoWhy would it diminish the role of Python ? One of the strength of Python is its capacity to integrate with anything. We never said it was the only language with that strength. With Python comes an ecosystem, another language another ecosystem. Choose the tool that fits your need.
- evgen 6y agoGiven the choice between using library bindings in Python and similar bindings in C++ or Java, the world has voted with their feet. When it comes to easy to use glue languages, Python won.
- est 6y agotl;dr python is slow and cant parallel. Julia is better because it's fast and julia all the way down.
- learningwebdev 6y agoAs somebody who is just getting into learning Python for web development and ML, am I better off switching to Julia right now? How steep is the learning curve compared to Python, and does it have a framework similar to Django for building web apps?
- miguendes 6y agoIMHO, no, stick with Python. Of course you can fiddle with Julia but Python is used in many fronts and much more versatile. If Python were a blocker for the adoption and development of ML, it wouldn't be the default language of the most popular ML libs. The reason is, the high performant code is written in C++/C/Fortran. Python is just used to glue everything and provide a nice and rich interface. That's what really matters. To me Julia is more to Fortran than Python. And it doesn't have many usages outside numeric programming. Scapping the Web, building rest APIs, Performing Data Analysis, Automation scripts is much easier in Python than Julia or Swift. Edit: typos
- dunefox 6y ago> much more versatile. > To me Julia is more to Fortran than Python. And it doesn't have many usages outside numeric programming. Again, you're making unsubstantiated claims. > Python is just used to glue everything and provide a nice and rich interface. That's what really matters. So, now I have to not only learn Python but also Fortran/C++/C because the underlying library that I might want to adapt is written in one of these languages. In Julia the DL library, for example, is written in Julia. What you are claiming is a pro is actually a con. > Scapping the Web, building rest APIs, Performing Data Analysis, Automation scripts is much easier in Python than Julia or Swift. That might be true for Swift, but certainly not for Julia.
- nl 6y agoSo, now I have to not only learn Python but also Fortran/C++/C because the underlying library that I might want to adapt is written in one of these languages. Basically the only time you'll want to do this from Python is if there is specific Fortran or C++ library you want to use. You'd have to do the same in Swift or Julia in this case.
- ovi256 6y agoI get that a language like Julia is better for library writers, but in my opinion Python is better for library users, and that has more weight. It will drive faster adoption, making the library popular. Meanwhile, the easily-written better-language library gathers cobwebs.
- m_mueller 6y agoI think Julia will gain some adoption replacing Fortran-, C- and C++ based libraries that can then also be used within Python. If you use any numerical packages, the above is already what you’re using under the hood. I also think that not enough people are aware of the performance limitations of NumPy code and how much more straightforward it can be to drop into a lower level language once you cross a certain optimization barrier. This is where Julia can increasingly serve an important role.
- phkahler 6y agoDoes Julia play well with Rust code? I see Rust as the future replacement for C++ so that would be important.
- TheRealKing 6y agoThis will not happen. There is so much hype around Julia and false claims such as Julia outperforming Fortran, etc. One can always design an isolated benchmark in which Julia outperforms any other language. But what people care, is performance in practice. And false claims will only hurt Julia in the long run, in the same way VolksWagen got badly hurt for its "US diesel emission fraud".
- fxtentacle 6y agoI feel like this misses the point. Python is used as the language to describe things, but nobody is executing Python on the GPU. Instead, things are transpiled into highly optimized byte code, C++ source, or chains of optimized GPU sharers. See TensorFlow XLA and AOT. So when I set up a training pipeline with TensorFlow, then it'll barely run any python while training. Instead, the TF C++ core will execute a network of TF CUDA operators for me, all inside one python function call. That's why pythons global interpreter lock is pretty much a non-issue by now. Since only 1% of my training time is even running inside python, I don't expect any performance benefits from replacing it. And if both are equally fast, I prefer the familiar option, meaning python.
- dgellow 6y agoYou can be sure that they are both well aware of this, Jeremy is one of the creator of the popular python library, book, and online course fast.ai built on top of PyTorch. The relevant part of the their discussion is this one: > Like Python is not the future of machine learning. It can't be. You know, it's so nicely hackable, but it's so frustrating to work with a language where you can't do anything fast enough unless you call out to some external code or C code, and you can't run anything in parallel unless you put in a whole other process. Like I find working with Python, there's just so much overhead in my brain to try to get it to work fast enough. It's obviously fine for a lot of things, but not really in the deep learning world or not really in the machine learning world. So, like, I really hope that Julia is really successful because there's a language with a nicely designed type system and a nicely designed dispatch system and most importantly, it's Julia all the way down so you can get in and write your GPU colonel in Julia, or all the basic stuff is implemented in Júlia all the way down until you hit the LLVM. Here the point is that when using other languages (such as Julia) you actually can use the same language for your GPU and for the glue that keep your scripts together.
- p1esk 6y agoI feel like you (and them) are still missing the point. 99% of users don't write GPU kernels. They use simple function calls and that's all they see. 99% of users don't care if they call CUDA code from Python, or Julia code from Julia, as long as both are equally fast and API is clean (e.g. Pytorch).
- miguendes 6y agoLike I said in a another comment. To me Julia has the potential to be the modern fortran. Python versatility is miles ahead. You can build Web APIs, Web apps, automation scrips, data scrapping and so on. Python is not the de facto language of ML nowadays because its performance. All the underlying performance sensitive code is written is C/C++/Fortran. Also, cython, which has great integration with python, is growing a lot and has been used in some cool projects such as aiohttp, fastapi, and spacy. So one more alternative to write fast code without giving up on python entirely.
- pjmlp 6y agoModern Fortran and C++ can be just as productive, and C++ based repls are starting to appear as well, which removes the dual language headache. Python community better embrace JIT tooling, now that projects like TensorFlow and Torch are going polyglot.
- dunefox 6y ago> Python versatility is miles ahead. You can build Web APIs, Web apps, automation scrips, data scrapping and so on. What? And you somehow cannot do that in Julia? > So one more alternative to write fast code without giving up on python entirely. I don't have to give up on Python, I can just use all libraries from Julia with PyCall. I'm just glad I don't have to use Python the language anymore than absolutely necessary.
- miguendes 6y ago
- pjmlp 6y agoAgreed, with something like a C++20 JIT based workflows remove the dual language barrier, and then there is Julia, and other JIT based languages with GPGPU backends.
- zmmmmm 6y agoIt's sort of one of those provocative statements that just mis-represents things to make controversy. I also believe Python is not the future of ML but it's because the future is more about the space maturing and becoming commoditised and "boring" which probably means, being completely honest, things that people have no interest in happening like it migrating over to the JVM etc. But who wants to talk about that?
- ForHackernews 6y agoJulia is wonderful and I'm really hoping it catches on: https://julialang.org/ https://julialang.org/ Unfortunately, it lacks a big-name sponsor like Go or Rust.
- pjmlp 6y agoIt has enough of them, https://juliacomputing.com/case-studies/ https://juliacomputing.com/case-studies/
- dklend122 6y agoJeremy has amended his comments regarding the viability of Julia Computing based on new information he received: https://twitter.com/jeremyphoward/status/1302678869158182912?s=19 https://twitter.com/jeremyphoward/status/1302678869158182912... The financials are more secure than stated in the video. (I don't work there, but I'm a fan)
- teleforce 6y agoI'm surprised nobody mentioned about D language for AI type of applications. It's a very fast compiled language and compile faster than most of its competitors. I supports interactive programming with rdmd and can work as a kernel inside Jupyter notebook through Jupyter's wire protocol[1]. It has friendly python vibe to it due to default to GC based ecosystem (but you choose to let go the GC where appropriate). With the introduction of DPP, its FFI capability to C/C++ is second to none if the needs arise to interface with the existing libraries in those languages and it can also easily interface seamlessly with python and R libraries! [2] It also has a growing library for big data analysis [3] and one of the main users of D is WekaIO, one of the prominent big data companies with the claim of the world's fastest file system for data storage [4]. If you insist on multiple dispatch style like Julia, you can emulate it as well in D [5]. If you want to see the glimpse of what D can offer for data science domain please check this "D is for Data Science" article [6]. Finally if you want to see D in action against Julia and Chapel for kernel matrix calculations that's common in AI type of applications please check this post [7]. [1] https://github.com/symmetryinvestments/jupyter-wire https://github.com/symmetryinvestments/jupyter-wire [2] https://dlang.org/blog/2020/01/27/d-for-data-science-calling-r-from-d/ https://dlang.org/blog/2020/01/27/d-for-data-science-calling... [3] https://dlang.org/blog/2018/12/04/interview-liran-zvibel-of-wekaio/ https://dlang.org/blog/2018/12/04/interview-liran-zvibel-of-... [4] http://docs.algorithm.dlang.io/latest/mir_ndslice.html http://docs.algorithm.dlang.io/latest/mir_ndslice.html [5] https://en.wikipedia.org/wiki/Multiple_dispatch#D https://en.wikipedia.org/wiki/Multiple_dispatch#D [6] https://tech.nextroll.com/blog/data/2014/11/17/d-is-for-data-science.html https://tech.nextroll.com/blog/data/2014/11/17/d-is-for-data... [7] https://dlang.org/blog/2020/06/03/a-look-at-chapel-d-and-julia-using-kernel-matrix-calculations/ https://dlang.org/blog/2020/06/03/a-look-at-chapel-d-and-jul...
- non-entity 6y agoD is weird to me. Ive only looked breifly at it, but I liked what I saw. I'm assuming it had some early issues or completely failed to market itself for too long because it seems to see very little use compared to similar languages.
- teleforce 6y ago
- ummonk 6y agoI love Julia, but what I don't get in this particular instance is to what extent it actually allows you to write code that you can't with Python. Sure, cassette allows you to do more powerful automatic differentiation, and various GPU arrays packages make writing code that runs on GPUs very natural, but it doesn't seem like that big an improvement over using a framework like TF / Pytorch / Numba in Python. Sure, those libraries aren't written fully in Python, but neither are Julia gpu libraries - you obviously have to convert to CUDA or similar code at some point to run on the GPU. Julia brings great improvements in ability to write simple idiomatic serial code that runs at near C speeds on the CPU (whereas idiomatic Python code is at least 10x slower if you use an optimal compiler, and 1000x slower if you use the standard python interpreter). But for highly parallel code dependent on element-wise or broadcasting array operations, I just don't see the issue with Python.
- amkkma 6y ago>neither are Julia gpu libraries Wrong. Julia can call out to Cuda kernels, but it also does codegen for custom ops and types. Technically with enough engineering time, someone could rewrite all those C cuda kernels in julia, and julia would just generate low level machine GPU code on the fly.
- snicker7 6y agoCalling out to array libraries in an interpreter (Python+Numpy, MATLAB, whatever) leaves a lot of optimizations on the table. The abstraction is not zero-cost. For example, the simple array expression v+cw (where v,w are vectors and c is a scalar) can be calculated using fused multiply-add instructions. But this is not possible when called in an interpreter, which has to make separate calls for each array operation. For the same reason, this same calculation may saturate the memory bus. This is not an issue with Julia or other compiled languages. Not sure how Numba and/or PyPy optimizes it.
- cdsousa 6y ago""" [...] it is possible to perform kernel-like operations without actually writing your own GPU kernels: a = CUDA.zeros(1024) b = CUDA.ones(1024) a.^2 .+ sin.(b) """ [https://juliagpu.gitlab.io/CUDA.jl/usage/overview/#The-CuArray-type https://juliagpu.gitlab.io/CUDA.jl/usage/overview/#The-CuArr...] As far as I know, that example code creates an ad-hoc kernel that performs the computation in a single pass. I honestly don't know if that is possible in other frameworks.
- deleted 6y ago[deleted]