219 points · by bookofjoe · 3y ago · 199 comments
Before Tensorflow, people (myself included) were largely coding all of this stuff pretty manually, or with the zoo of incredibly clucky homemade libs.
Tensorflow and PyTorch made the whole situation far more accessible and sane. You can get a basic neural network working in a few lines of code. Magical.
But it's still early days. George Hotz, author of tinygrad[0], a PyTorch "competitor", made a really insightful comment -- we will look back on PyTorch & friends like we look back on FORTRAN and COBOL. Yes, they were far better than what came before. But they are really clunky compared to what we have today.
What will we have in 20 years?
[0] https://github.com/geohot/tinygrad, https://tinygrad.org
This is a fantastic skill set to solo-hack a complicated piece of software and produce a proof-of-concept, but not for building a tool that people actually use. See his track record of never building any successful product after his PS3 & iOS jailbreaks, his latest resignation memo from Comma.ai, and his resignation from Twitter after just 4 weeks.
So I think it's kind of hilarious that you're citing him and his newest tinygrad project in one sentence with the assertion that PyTorch & friends will soon be considered ancient and clunky tools. While I don't necessarily dispute the latter, I'm certain that tinygrad won't be the one replacing them.
Some fields are literally defined/created by personality cults.
His rap about getting sued by sony is a classic.
Hopefully something that doesn't require the user to be a math wizard.
I'm not into data science by any means, and I first learned about tensors with Tensorflow. While I would like to experiment with neural nets, the current frameworks require me to learn the foundations of how they work. I'm sure I'll get arguments that this is a good thing, but I just want to do some cool stuff with computers, not take math courses to learn how the cake is made.
High-level programming languages are abstractions to machine code that, for the most part, don't require the user to know how they work internally. I think we're missing similar abstractions for ML, or it's possible they already exist and I haven't looked hard enough.
What is needed are higher-level abstractions over ML principles that make ML more accessible for people who are interested in programming, but lack the math background to be productive. This doesn't necessarily mean that the lower-level details should be entirely hidden, but that the tools are friendly enough for beginners to easily pick up, and flexible enough for advanced users to tweak to their needs.
I guess it depends a lot on perspective, to me the whole field looks like alchemy more than science. The results cannot be denied, but we understand so little.
Now you have the likes of HuggingFace which is another abstraction on top of Pytorch. Heck you don't even need to code a transformer from scratch. They have done it for you.
from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") model = AutoModelForMaskedLM.from_pretrained("bert-base-uncased")
I was like wow, this level of abstraction is totally breaking barriers to entry and we will see many many flavours of huggingface in the years to come.
If you want to do research in any branch of ML, you are almost certainly going to need some strong mathematical foundations. At the same time, if you're more interested in applying existing architectures/models, the ecosystem has a lot of really amazing tools that will take you a very long way without requiring you to study statistical learning theory.
They have a course that goes exactly like that (Practical Machine Learning or similar). You start high level with libraries and just a few lines of code, and gives you the high level tools to use ML in your projects, and sometimes goes a bit lower level when needed.
[0] https://www.amazon.com/Deep-Learning-Coders-fastai-PyTorch/d...
It’s not so much how the cake is made but rather what you are actually doing.
You can already make something cool today by using end products and stringing their api together which might be what you are looking for.
If you want to make something new however and wish to use ML tools, well, at some point, you will have to learn what these tools actually are.
You don’t have to know how the operations involved doing what they’re doing, in the sense that you don’t need to know how matrix multiplication is implemented any more than you need to understand Timsort to call sort() in Python, but you do need to know matrix arithmetic. That isn’t being a math wizard, it’s the price of entry.
Tensorflow doesn't actually have any tensors. At least not in the sense that tensor used to be used before Tensorflow. Tensorflow just has arrays.
See https://en.wikipedia.org/wiki/Tensor for the old, original meaning.
The best tool I've used for vector/matrix processing is MATLAB (or GNU Octave, which is free but without as many libraries). To say I'm disappointed that these never gained the same traction as Python would be an understatement.
Unfortunately, these tools all suffer from a lack of insight from programmers. We abstract whenever possible, but for whatever reason, academics have a certain expectation that the user learn the entire system before starting. I believe that's why functional programming never quite caught on. That egocentric view infects everything from Mathematica/WolframAlpha to UNIX.
I prefer other models. For example, I don't feel that anyone has explored genetic algorithms under the Actor model yet. Which severely limits how fast the user can explore a problem space. Part of that is due to hardware. A GPU may present itself as having X number of teraflops or whatever, but only have something like 64 cores and no API to access them directly like a CPU. Which limits it to a paltry number of environments and/or automatons to evolve.
A better architecture would be something like 1024+ symmetric cores with a unified copy-on-write, content-addressable memory accessible through ordinary C desktop programming and orchestrated with something like Docker. Then we could explore auto-parallelization with languages like Julia and Clojure, possibly even Rust. I've written about that extensively throughout the years, but there's still been no change to the status quo, so I've all but given up on that. I do see a small hope with RISC-V on FPGA though.
The somewhat ironic thing is that AI is evolving so quickly that it's passed the Turing test now for the masses. We only have maybe 5-20 years before it solves all problems better than us. So it's an odd feeling for me to have waited 20 years with no progress on the hardware that I needed to do what I wanted to do, only to make the thing I wanted to do irrelevant anyway. That's the challenge we all face now as play is automated by AI while we still have to go to work and pay rent within a 20th century Matrix reality. I hope we find a way to reverse that trend before we're too old to care anyway.
Ideally, this should all be integrated at the compiler level. Programming languages and their associated standard libraries should expose differentiation as a first-class abstraction, along with everything else.
The problem is that the whole space is really immature, and huge strides are being made... but by many disparate groups, all working in different spaces and languages.
Just in the last few months I read about several Python ML frameworks, a Julia differential compute capability, and that Haskell has a library where even the type system can express differentiation of general algebraic data types!
The whole ecosystem needs to... congeal a little bit.
This whole space reminds me of Object Oriented programming before C++ and Java.
It's not really the same sort of differentiation. Derivatives of algebraic data types (as implementable in Haskell) only generalize formal derivatives of polynomials. You need a lot more machinery before you can talk about smoothness.
Using Tensorflow doesn't require you to know all the details, you build a model of the network, and it actually executes that model. The low level stuff is handled.
You still have to know how to tell when it is working, or not. Properly rationing your training/testing/validation ports of data is surprisingly important for not ending up with a model that seems to work great until you use it in the real world.
Will handcrafted, math used me better.
Very likely.but a VW is good enough for 99 percent of use cases :)
And guess what? It is good life strategy.
Well, that's not obvious for me. The metrics do not support the death of Keras / TF (https://twitter.com/fchollet/status/1614322127460782087)
François Chollet's Deep Learning with Python is arguably the best book on the topic and teaches people using Keras / TF2. The Keras documentation is excellent as well, and in the long run it will matter. Personally I prefer the way the Keras / TF2 APIs work to PyTorch as well.
Also, I am pretty sure a JAX backend is coming to Keras, and there is TF Lite...
I cannot make a prediction as to which stack will dominate in five years.
You might not see TensorFlow's plumbing much anymore if you're a new grad running experiments in a notebook, but the "porcelain API" is just the tip of the ice berg of modern machine learning.
If you do any work on the JAX framework, you're frequently working with both the JAX and TensorFlow code repositories: https://github.com/google/jax/blob/main/WORKSPACE#L17
Excuse me but, what? You could say this about pretty much every "hot" framework. Technology moves fast.
I was doing ML academia stuff in the pre-TF era, and most of my department was using custom C++/CUDA, or a pile of random stuff like https://en.wikipedia.org/wiki/Weka_(machine_learning) and https://en.wikipedia.org/wiki/Waffles_(machine_learning).
Our department also didn't even have GPUs to use for the first part of my time there, whereas now it would seem ridiculous to have an ML research wing without access to GPUs.
At the time, there seemed to be a lively ecosystem but no clear winner. Theano, Caffe and Torch were the main hitters but there were smaller players too. Torch was particularly good, maybe functionally ahead (but I don't really remember for sure) but hampered because, at the time, it was Lua only. In fact Keras's first release said "Keras is a minimalist, highly modular neural network library in the spirit of Torch, written in Python / Theano so as not to have to deal with the dearth of ecosystem in Lua."
When TensorFlow was released, it looked like that would be the death of all the other libraries. The fact that any others survived at all is really down to how hard to use TensorFlow was (/is?). It didn't live up to the expectation of being the killer of other libraries.
I work on a ton of stuff that would very much benefit from being differentiable, but also very much can’t fit at all into the “stack a ton of linalg-like layers”.
It’s a huge engineering effort to even try to think about how I might start taking out derivatives. It’s possible but there’s so much overhead to do anything with it.
And that isn't even the coolest thing about working in Julia: just wait til you see what people can squeeze out of macros.
Non-smooth functions (e.g. abs(x)) can be handled with bundle methods, but how would one make inherently discontinuous (non-convex) functions differentiable? (e.g. if x then 1 else 5)
Discrete problems are inherently non-differentiable. There are approaches like complementarity methods and switching functions (tanh) usually end up with numerical issues.
if(i<0) return 0; else return 1;
Now ReLU is continuous itself (as well as being monotonic) so it still cooperates relatively well with gradient descent algorithms. I think this is where the problem lies - not with differentiability itself, but with gradient descent not working due to the highly non-convex search space that such general programming constructs will produce.
experimental support in pytorch
It's already there in PyTorch since a while (2019). However, as far as I know, it has not found too much adoption yet.
In our framework RETURNN, we also make heavy use of dimension tags: https://returnn.readthedocs.io/en/latest/getting_started/dat...
Whatever it is, I sincerely hope that it is not driven by Python, and instead we have a more accessible language.
Say what you will about Python, but it is a total pain in the arse to work with. The 2.x legacy still casts a long shadow (in terms of online guides, unmaintained libs etc), anaconda, pip, easy install, strings/unicode, type hints (or not), unreadable & unmaintainable list comprehensions etc etc etc. What a dumpster fire, and a truly hateful language.
Here is hoping that some other language takes over. I have my personal take, but I won't let that ruin the rant :)
This is the same angle that pg used in one of his essays: Back then people liked Java because the huge amount of boilerplate made them look productive. In Lisp you stare into the REPL and notice that you don't have any ideas about the actual problem you are trying to solve.
I would also prefer another language. A well written C++ library (the one in pytorch seems a bit rough and a second class citizen) would already be a step up.
I think programmers fall into different camps on this issue.
Ok. What would be your suggestion for a language that "just works?"
Keras is nowadays the front-end to TF, so this paragraph doesn't make sense. In light of this misunderstanding the author's views don't carry a lot of weight.
PyTorch, on the other hand, is very centered around Python — that’s why it feels so pythonic after all. There is a C++ API, but there isn’t half the support for other languages that TensorFlow offers."
This is also a big reason why CUDA won over OpenCL.
NVidia recognised early on (around CUDA 3) that have a polyglot infrastructure was a much better option, so eventually plenty of toolchains started to target PTX, while OpenCL was stuck into "compile to C" alternative.
It didn't help that AMD and Intel hardly did anything to improve the situation when SPIR finally came out.
I badly wanted something decent as an alternative to CUDA for quite a while, but even after leaving AI myself, it is clear they are not near the standards that NVIDIA has been offering for nearing a decade now already.
We don't even have to get into all the issues consumers have gotten with AMD's GPUs.
[1]: https://arxiv.org/abs/2206.10034
[2]: https://www.intel.com/content/www/us/en/developer/articles/t...
[3]: https://www.usenix.org/conference/atc19/presentation/liu-yiz...
Unless one is happy using vim and emacs to target GPUs, coding in C or C++, with either pixel debugging or lame printfs.
Making fire with stones to avoid a proprietary lighter.
I'm stealing that quote!
While Apple initially promoted OpenCL, Android never supported it as official API rather Renderscript.
So on iOS eventually Apple moved into Metal, usable from Objective-C and Swift, while on Android, Google has deprecated Renderscript usable from Java and Kotlin, pushing everyone to now learn Vulkan compute and do the integration on the NDK by themselves while learning C, C++ and GLSL on the process (as no big deal from their POV).
Basically hardly anyone cares with such great usability story. /s
Still, remember that if you're not in the PC space, CUDA might not even be an option for you.
Are you saying polyglot is better, and leads to dominance?
Are you saying, TensorFlow is more polyglot than PyTorch? Or if not, isn't that what your quote says, though? TF supports much more languages. Or what do you mean by polyglot?
But then, this would imply that TensorFlow would dominate over PyTorch? But the article says the opposite?
Yes, TensorFlow is more polyglot than PyTorch.
Sure you can't train your models in javascript with pytorch, but not sure you want to use any other language than python for that, since python already has all the ecosystem
I'd argue polyglot is only better when alternaives offer benifits. Like polyglot cloud providers you can mix prices, polyglot program runtimes you get multi-OS support, polyglot ORM you can migrate to new DB with shiny features.
What do you gain by polyglot ML models out of Python?
If I have an array `x` and want to set index 0 to 10, I cannot do:
x[0] = 10
I instead have to do: y = x.at[0].set(10)
I'm sure I could get used to it, but it really puts me off.PyTorch 2.0 has gotten a similar underlying feature for torch.compile now. https://pytorch.org/get-started/pytorch-2.0/
https://jax.readthedocs.io/en/latest/debugging/print_breakpo...
I had 100x the amount of questions with TensorFlow compared to PyTorch. With PyTorch I can jump into every part or the training process and easily debug. Often no need for StackOverflow.
I am glad not have to deal with TF’s black box VM approach that seems optimized for selling Google products, more than solving machine learning.
Seriously!? Author has no clear idea of what she's talking about. Keras IS THE front end of TF. They are not different, they are the same thing!
> PyTorch is better for students and research
> TensorFlow has the better deployment infrastructure
Ammm... OKAY!?
I'm not a TF fan or anything but reading some half baked absurd claims and saying one is better over another is just nuts. Both frameworks are built to satisfies the need of different demographics of projects, people and organizations. It's NICE to learn both, use both where required and I wish that both frameworks continuously evolves and make this space more accessible to built & deploy more complex solutions. Also f$%$ JAX, no one cares about you so just STFU.
On StackOverflow, so many questions will get closed, as being too vague, unclear, duplicate, off topic, or whatever. I assume many people moved to the official forum instead.
TensorFlow also recently (much later) has such a forum (https://discuss.tensorflow.org/), but I think it's way less active.
But ultimately it will depend on what kind of such ML enabled "killer apps" become popular. Maybe they live in the browser or in some IoT and thus give the edge to js or c++ implementations rather than python.
It's more a question what most of the community uses, esp the research community uses, as that is what gets into production first at some point. If you have your nice model already in PyTorch, why recode it in TF later?
So, the ML framework adoption always has a bias towards what's more friendly for the researchers, and developers.
I don’t like how easy to measure things are conflated to mean more important things.
SO traffic shouldn’t mean something is more widespread without some more information.
Maybe PyTorch has great documentation and doesn’t need as many questions. Or maybe PyTorch users are on slack or irc for their questions.
SO is a good sign that a tool is being used generally, but I don’t think should be used to compare. I think counts if SO are nominal and not even ordinal for purposes of a technology’s use.
I’m not sure how to actually evaluate products. Maybe downloads? Or publications? Or referencing projects, although this is hard as there are many non-OSS projects that can’t be counted.
Anyway, this seems to irk me since people will equate “n people tweeted” with meaning something other than “n people tweeted.” Like somehow something being measureable makes it mean something.
If you search for 'distilbert-base-uncased-finetuned-emotion' (picked only because I noticed it a lot down in the tail) you'll find five hundred and twenty seven results. Are they all the same? Different? Who knows!
I'm going to guess that there's some kind of 'learn ml' class that as part of the curriculum teaches students to upload to huggingface and that's skewing the numbers beyond use.
Also using TF is a PITA so all in all, I don't want to spend time using it.
But I'd wish there were as good libraries for typed languages. Exploratory coding in python is so hard, because you don't know what you can do with a library or your tensors etc.
It's almost like you are coding in a separate language altogether sometimes. E.g. you write something in Cython that gets compiled to C/C++. Same holds for things like numba/LLVM or Jax/XLA. PyTorch is going bigger on compilation in PyTorch 2.0.
Python can be seen as a common interface to write code that can be JIT compiled to multiple backends. It's quite convenient to be able to interact with all these backends, and bring the results back to a universally common interface (NumPy).
From this perspective, scientific Python itself is somewhat evolving by itself into something like Julia, which is JIT compiled to LLVM. Except Python's momentum has generated a huge number of backends for users to choose from.
I'm all for a new language dethroning Python in scientific computing. But I don't think it will be for reasons of speed. I think it'll likely be things like typing (e.g. from Dex lang) or library modularity (e.g. Julia).
I mean, Apple is trying to force people to code ML in Swift and I don't think I have ever even seen anyone in this space who even knows what Swift is. I mean, they provided all this nice ML framework to run stuff on M1+, and all everyone was asking: "Yeah but how do we do this from PyTorch?"
Tensorflow Serving is nice in that it's so tightly integrated with Tensorflow. As usual that goes both ways. It's so tightly coupled to Tensorflow if the mlops side of the solution is using Tensorflow Serving you're going to get "trapped" in the Tensorflow ecosystem (essentially).
For pytorch models (and just about anything else) I've been really enjoying Nvidia Triton Server[0]. Of course it further entrenches Nvidia and CUDA in the space (although you can execute models CPU only) but for a deployment today and the foreseeable future you're almost certainly going to be using a CUDA stack anyway.
Triton Server is very impressive and I'm always surprised to see how relatively niche it is.
It just feels so clunky, and progress was so slow.
A model saved in 2.0 should work in any later 2.x version.
In practice, they've changed the implementation of the batch normalisation layer at least twice, causing 3 sig fig differences in a unet.
They just don't seem to care about production use of tensorflow.
Another thing he likes to shout about is pip installs. PyTorch suggests and sets to default conda. Everyone gets PyTorch via conda.
Chollet occasionally shouts about pip install numbers of PT vs. TF on Twitter and thus TF being superior.
I wonder if there are better alternatives than tfjs for cross-platform mobile apps.
what use case do you have that will benefit from a trained model?
Competition is only good if it brings something to the table.
Python is a simple language, and for many AI researchers pytorch was an easy way to not get bogged down in implementation details for rapid experimentation.
I'm guessing you're referring to this?
> PyTorch is still growing, while TensorFlow’s growth has stalled. Graph from StackOverflow trends (https://insights.stackoverflow.com/trends?tags=pytorch%2Cten...)
Graph seems to confirm what they are saying, in terms of questions asked on Stack Overflow. Number of PyTorch questions are growing, number of TensorFlow questions have plateaued and maybe even shrinking, but bit early to tell.
I wouldn't necessarily say that growing/shrinking number of questions on Stackoverflow means a project is less/more popular than another, can be because of number of factors (more experienced developers, better documentation, better support channels via some other platform, and so on), so I don't think the conclusion is 100% on spot. But at least the graph accurately describes what it's supposed to describe.