Earlier quoted context omitted.
> they're dynamically shaped and hit near peak While this is true for most common GEMM looking ops, if you tread off the beaten path things get slow (odd channel sizes, batch sizes, etc...). Right now in PyTorch, GroupNorm is 2x slower than BatchNorm. There's no fundamental reason, just that the kernels loop over axes in a less than ideal order. Dynamic recompilation allows you to change the loop order too, not just…
> Right now in PyTorch, GroupNorm is 2x slower than BatchNorm How did you benchmark this? I think there are like 3 or 4 different GN implementations in PyTorch..
Tinygrad: A simple and powerful neural network framework
131–140 of 147 posts
Re: Tinygrad: A simple and powerful neural network framework
#132Earlier quoted context omitted.
> Right now in PyTorch, GroupNorm is 2x slower than BatchNorm How did you benchmark this? I think there are like 3 or 4 different GN implementations in PyTorch..
Whole net performance at comma, when we switch from BatchNorm to GroupNorm it adds 70ms to the training step time, and it's -70ms for no norm. We also wrote a custom AllNorm that's like 10% slower than BatchNorm (and I put several hours into trying to optimize it). Obviously not indicative of everyone's experience, but my point is BatchNorm is hyperoptimized and others, which are pretty much the same thing, aren't.
I'm also wondering if the handcoded backward passes are actually "numerically correct", because e.g. epsilon doesn't appear in it at all. Someone worked out the gradients manually for BN here: https://web.archive.org/web/20180826123459/http://cthorey.gi...
You can clearly see epsilon appearing in the output. And of course there's the whole training vs. eval mode thing with BN which GN doesn't have.
In any case, thanks again.
Re: Tinygrad: A simple and powerful neural network framework
#133tinygrad core is over 1000 loc now[1]. If anyone was looking for a fun weekend project :) https://github.com/geohot/tinygrad/blob/master/.github/workf...
It does achieve that by being most horizontally dense Python code I've ever seen.
Re: Tinygrad: A simple and powerful neural network framework
#134I believe neural networks are over hyped sometimes. They are not always the best tool for the job. There are lots of other ML techniques such as SVM, naive Bayes, k-nearest neighbor, decision tree, logistic regression, random forest etc. nobody is using because they lack the hype factor. If something lacks some keywords like neural network, deep learning, reinforced learning, than it is deemed not cool.
Re: Tinygrad: A simple and powerful neural network framework
#135Earlier quoted context omitted.
I can't think of anything that neural nets can't beat, except small tabular data with boosted decision trees. Can you give some examples?
Explicability is a big part of it It is often worth being a percent less accurat but having an explainable result.
Re: Tinygrad: A simple and powerful neural network framework
#136Earlier quoted context omitted.
The problems where traditional ML works best and the problems where Transformers or ConvNets work best are usually two different domains. AI is not a buzzword.
>The problems where traditional ML works best and the problems where Transformers or ConvNets work best are usually two different domains. Yes and we are using NN for everything.
Re: Tinygrad: A simple and powerful neural network framework
#137 Cherry Three (5nm tapeout)
=====
* Support DMA over PCI-E 4.0. 32 GB/s
* 16 cores
* 8M elements in on board RAM of each core (288 MB SRAM on chip)
* Shared ~16GB GDDR6 between cores. Something like 512 GB/s
* 16x 32x32x32 matmul = 32768 mults
* 1 PFLOP @ 1 ghz (finally, a petaflop chip)
* Target 300W, power savings from process shrink
* This card should be on par with a DGX A100 and sell for $2000
* At this point, we have won.
* The core Verilog is open source, all the ASIC speed tricks are not.
* Cherry will dominate the market for years to come, and will be in every cloud.
* Sell the company for $1B+ to anyone but NVIDIA
[0] https://github.com/geohot/tinygrad/blob/master/accel/cherry/...Re: Tinygrad: A simple and powerful neural network framework
#138Earlier quoted context omitted.
Explicability is a big part of it It is often worth being a percent less accurat but having an explainable result.
I've been on a lot of ML teams and outside of Finance and a few other sensitive topics explainability has always been irrelevant.
Re: Tinygrad: A simple and powerful neural network framework
#139Earlier quoted context omitted.
Or, better, identifying that the machine has a primitive that is better than doing each op individually. For example, a multiply-accumulate instruction vs a multiply and separate accumulate. The source code still says "a*b+c", the compiler is just expected to infer the MAC instruction.
Yep! This is an assumed optimization when it comes to modern linear algebra compilers. New primitives go way beyond FMAs: full matrix multiplies on nvidia/Intel and outer product accumulates on Apple silicon. It’s also expected that these are used nearly optimally (or you’ve got a bug).
Re: Tinygrad: A simple and powerful neural network framework
#140Earlier quoted context omitted.
> Sentiment analysis trained on the standard datasets is one place where performance is barely better than old-school linear classifiers Well yeah. But why would you do that? Do what eveyrone does: Train on large scale a language corpus (or use a pre-trained model) then finetune for sentiment analysis. > I strongly advice against using something fine-tuned solely on sentiment datasets Did you mean trained on sentimen…
No, I meant finetuned. I also meant finetuned when I said trained. Experience with applying finetuned sentiment classifiers on real world data found gain vs cost of running to not be worth it. They remain nearly as brittle as cheaper classifiers and have a habit of gloming too much unto certain adjectives. They are also prone to overfitting on finetuned data's domain. Transformers trained not specifically on sentimen…
But if the rest of your model is frozen the head will never see actual words, just contextual vectors from the LM.
It feels like we are in strong agreement but using slightly different terms or something