from Hacker News

PyTorch: Where we are headed and why it looks a lot like Julia (but not exactly)

by thetwentyone on 11/26/21, 9:45 PM with 282 comments

  • by xbpx on 11/26/21, 11:04 PM

    Java has a massive ecosystem yet we continue to see rapid replacement of backends in JavaScript (Node now Deno) and Golang. Each of those language ecosystems rapidly became both large (arguably too large) and robust.

    Rust has been eating C++ lunch. Same rapid rise of ecosystem story.

    Instead of forcing Python to be a language it isn't it might be more efficient and ultimately the "right choice" to invest the time in Julia.

    Julia is great for numerical computing, it needs faster time to plot and more hands in the ecosystem. The former will be solved and the latter seems inevitable to me. Pitch in!

  • by FridgeSeal on 11/27/21, 1:31 AM

    This seems so silly to me.

    It’s PyTorch-if they said “the next version of PyTorch will be in Julia, the ecosystem would shift accordingly.

    They’re practically saying “this language has every feature we need and want, most of them already existing, but we’re going to continue re-inventing them in this objectively less suitable language because we clearly wish to make life harder for ourselves”

  • by jszymborski on 11/26/21, 11:38 PM

    I've been thinking a lot about trying to use functional dialect of Python like Coconut[0] and Hy[1] w/ JAX so I can write functional DL code.

    Glad to see functorch[3] as PyTorch is the library I have the most experience with.

    [0] http://coconut-lang.org/

    [1] https://docs.hylang.org/en/alpha/

    [2] https://github.com/google/jax

    [3] https://github.com/pytorch/functorch

  • by pilooch on 11/27/21, 11:06 AM

    Loving pytorch but the reasoning remains strange to my ears: Python at all cost, not Julia, because of the ecosystem, well OK.

    But all bullet points are about things that are easily done right now with libtorch (pytorch underlying C++ core code), and the hassle is... Python.

    Well rational conclusion would be, just do everything in C++, and bind to Python. Make C++ first citizen here, since in all cases it'll be needed for performance, forever.

  • by forrestthewoods on 11/26/21, 11:08 PM

    The more I use Python the more I hate it. It’s genuinely a bad language, with a stellar ecosystem. Ironically, the most valuable parts of the ecosystem are often written in C (NumPy).

    It’d be interesting to see how much of the Python ecosystem is actually necessary to move PyTorch to a better language.

    I’m afraid we’re stuck with Python for the next 20 years. That makes me very, very sad.

  • by geofft on 11/26/21, 11:35 PM

    > Julia says:

    > A language must compile to efficient code, and we will add restrictions to the language (type stability) to make sure this is possible.

    > A language must allow post facto extensibility (multiple dispatch), and we will organize the ecosystem around JIT compilation to make this possible.

    > The combination of these two features gives you a system that has dynamic language level flexibility (because you have extensibility) but static language level performance (because you have efficient code)

    Given those constraints, the first language that comes to mind is Java. Why is Java basically not a player in the scientific-computing game?

  • by stabbles on 11/26/21, 11:03 PM

    What stage of Julia denial is this?
  • by opus111 on 11/28/21, 1:19 AM

    Why do people keep claiming that Julia's ecosystem is limited? Julia can use all of Python's libraries. They all work great. No need to reimplement in Julia, just use PyCall and your favorite Python code.
  • by streamofdigits on 11/27/21, 4:07 PM

    It feels a risky proposition at this juncture to go short python. The arguments against/for have been rehashed a million times, the redeeming features of julia have been articulated very cogently...

    What has not been accounted for is that the huge community / network effect of the python ecosystem is very far from exhausting itself. If anything, it is just starting as the exponential growth has mostly been the last few years (tautology, he he)

    A major investment to eliminate python technical debt would make more sense if things were stagnant and the re-engineering would open up entirely new domains.

  • by cookieater on 11/27/21, 2:05 PM

    I've used Julia for quite a few years now. It's biggest flaws in my opinion are basically cultural and not technological. It's been adopted mostly by serious domain experts rather then typical software engineers and more 'normal' people. I don't know say junior or senior scientists. This has lead to amazing results but also has it's own detriments.

    Some portions of the ecosystem are rock solid, especially the parts where JuliaComputing makes money from consulting(not all but some). Other parts are beds of sand/permanent research projects. The median experience is usually someone points you to a package and it doesn't really do what you hoped it would so you end up adapting it and rolling your own solution to a problem. Maybe you try to make a PR and it gets rejected because of "not invented here"/academia mindsets, either way you made a fix and your code works for you.

    What makes this barrier hard to overcome for adoption is: trust, and blind spots. People who aren't experts in a casual work area (maybe computer vision) realize they can't use a tool to do something `basic` and run away to easier ecosystems(R/Python). People who are experts in other areas, check credentials of packages see that an ivy league lead researcher made it and assumes it's great and usable for a general audience. So you'll get a lot of "there's a package for that" but when you go to use it you might find the package is barren for common and anticipatable use cases in industry (or even hobbies).

    This makes Julia best positioned as a research tool, or as a teaching tool. Unfortunately - where Julia actually shines is as a practical tool for accomplishing tasks very quickly and cleanly. So there's this uncomfortable mismatch between what Julia could be and what it's being used for today. (yes Julia can do both not arguing against it). The focus on getting headlines far outsurpasses stable useful stuff. Infact, very often after a paper gets published using Julia, a packages syntax will completely change - so no one really benefits except for the person who made the package.

    Interestingly, 1 person(with some help of course) fleshed out the majority of the ecosystems need for interchange format support(JSON), database connections, etc. It's not like that person is jobless spending all their days doing it - it was a manageable task for a single smart person to kick off and work hard to accomplish. Why? Because Julia is amazing for quickly developing world class software. That is also kind of its detriment right now.

    Because its so easy to create these amazing packages you'll find that a lot of packages have become deprecated or are undocumented. Some researcher just needed a 1 off really quickly to graduate, maybe the base language(or other parts of the ecosystem) changed many times since its release. Furthermore, if you try to revitalize one of these packages you'll sometimes find a rats nest of brilliance. The code is written very intelligently, but unpacking the design decisions to maintain world class performance can be prickly at best.

    One of Julia's strengths is it's easy/clean to write fast enough code. One of its downsides is, this attracts people who focus on shaving nanoseconds from a runtime (sometimes needlessly) at the expense of (sometimes) intense code complexity. Performance is important, but, stable and correct features/capabilities mean more to the average person. After-all, this is why people use, pay for, hire for: Matlab, Python and R in the first place - right?

    Most people don't want to have to figure out which ANOVA package they should use. Or find out in a bad way some weird bug in one of them and be forced to switch. Meanwhile in R: aov(...).

    Do I blame Torch for not using Julia? No. Should they consider using it? Yes, absolutely. Does Julia's cultural issue need attention before risking Python(or anything else) reinventing a flavor of Julia that's more widely used for stability reasons alone - in my opinion, yes (see numba, pyjion, etc). Still love the language, because technologically it's sound, but there are blemishes. I'd chalk it up to growing pains.

  • by 71a54xd on 11/27/21, 12:54 AM

    I was surprised when browsing PaperSpace.com (a gpu host for ML training) that Fast.AI is now considered a "legacy" software? I've built a few small classifiers / ML projects but not really enough to really branch out of an intermediate tutorial.

    With how quickly these frameworks change it's overwhelming to keep pace! Anyone have advice for solid frameworks that can reasonably leverage GPU's without too much heavy lifting?

  • by adsharma on 11/28/21, 12:11 AM

    I'm surprised that no one brought up using a subset of python with an emphasis on static typing, efficiency and transpilation can give you both the ecosystem and the efficiency.
  • by adenozine on 11/26/21, 11:09 PM

    Neither language have proper tail call elimination, which, is absolutely insane to me.

    Yall really just write procedural code for everything?

  • by nothrowaways on 11/27/21, 1:38 PM

    Why not go? Go beats Julia in parts where python is not good at. Is it because fb vs Google?