Live data from Hacker News

Accelerated PyTorch Training on M1 Mac

pytorch.org

91–100 of 153 posts

Re: Accelerated PyTorch Training on M1 Mac

#91
post #55

yess! This is important for me, because I don't have any $$$ to rent GPUs for personal projects. Now we just need M1 support for JAX. Since there are no hard benchmarks against other GPUs, here's a Geekbench against an RTX 3080 Mobile laptop I have [1]. Looks like it's about 2x slower--the RTX laptop absolutely rips for gaming, I love it. [1] https://browser.geekbench.com/v5/compute/compare/4140651?bas...

You can use GPUs for free on Paperspace Gradient, Google Colab, and Kaggle.

Re: Accelerated PyTorch Training on M1 Mac

#92
post #48

This is really cool for a number of reasons: 1.) Apple Silicon currently can't compete with Nvidia GPUs in terms of raw compute power, but they're already way ahead on energy efficiency. Training a small deep learning model on battery power on a laptop could actually be a thing now. Edit: I've been informed that for matrix math, Apple Silicon isn't actually ahead in efficiency 2.) Apple Silicon probably will compete…

[deleted]

Re: Accelerated PyTorch Training on M1 Mac

#93
post #48

This is really cool for a number of reasons: 1.) Apple Silicon currently can't compete with Nvidia GPUs in terms of raw compute power, but they're already way ahead on energy efficiency. Training a small deep learning model on battery power on a laptop could actually be a thing now. Edit: I've been informed that for matrix math, Apple Silicon isn't actually ahead in efficiency 2.) Apple Silicon probably will compete…

[deleted]

Re: Accelerated PyTorch Training on M1 Mac

#94

Earlier quoted context omitted.

Yes. And the M1 Ultra has even more memory bandwidth than the M1 Max. But a 128 GB system made of 3 NVidia A6000 has 3x768Gb/s of memory bandwidth, a more common AI-grade card has 2x2Tb/s of memory bandwidth, which simply dwarfs the M1 Ultra.

For researchers, sure, but it's still quite an apples-to-oranges comparison. A6000 is ~$5k per card. I guess you're referring to something like an A100 on that other spec, which is $10k/card (for 40GB of memory). I do a fair bit of neural/AI art experimentation, where memory on the execution side is sometimes a limiting factor for me. I'm not training models, I'm not a hardcore researcher--those folks will absolutely…

Hmm, that's interesting. What kind of inference workload requires more than the 48GB of memory you'd get from 2 3090s, for example? I'm genuinely curious because I haven't ran across them and it sounds interesting

Re: Accelerated PyTorch Training on M1 Mac

#95
post #29
post #10

Nice results! But why are people still reporting benchmark results on VGG? Does anybody actually use this network anymore? Better would be mobilenets or efficientNets or NFNets or vision transformers or almost anything that's come out in the 8 years since VGG was published (great work it was at the time!).

why are people still reporting benchmark results on VGG? Probably because it makes the hardware look good.

No. Because it is a way to compare performance. That’s all. Just convenience.

Re: Accelerated PyTorch Training on M1 Mac

#96

Earlier quoted context omitted.

For researchers, sure, but it's still quite an apples-to-oranges comparison. A6000 is ~$5k per card. I guess you're referring to something like an A100 on that other spec, which is $10k/card (for 40GB of memory). I do a fair bit of neural/AI art experimentation, where memory on the execution side is sometimes a limiting factor for me. I'm not training models, I'm not a hardcore researcher--those folks will absolutely…

Hmm, that's interesting. What kind of inference workload requires more than the 48GB of memory you'd get from 2 3090s, for example? I'm genuinely curious because I haven't ran across them and it sounds interesting

GPT-3 sized models need that kind of memory for inference

Re: Accelerated PyTorch Training on M1 Mac

#97

Earlier quoted context omitted.

In machine learning (especially deep learning or neural networks), the 'training' is done by using Stochastic Gradient Descent. These gradients are computed using Backpropagation. Backpropagation requires you to do a backward pass of your model (typically many layers of neural weights) and thus requires you to keep in memory a lot of intermediate values (called activations). However, if you are doing "inference" that…

This sounds really fascinating. Are there any resources that you'd recommend for someone who's starting out in learning all this? I'm a complete beginner when it comes to Machine Learning.

Deep Learning with Python (2nd ed), by Francois Chollet.

If you don't mind about learning the part where you program, it's got a lot of beginner/intermediate concepts clearly explained. If you do dive into the programming examples, you get to play around with a few architectures and ideas and you're left on the step to dive into the more advanced material knowing what you're doing.

Re: Accelerated PyTorch Training on M1 Mac

#98
post #96

Earlier quoted context omitted.

Hmm, that's interesting. What kind of inference workload requires more than the 48GB of memory you'd get from 2 3090s, for example? I'm genuinely curious because I haven't ran across them and it sounds interesting

GPT-3 sized models need that kind of memory for inference

GPT-3 is more like 300GB iirc

Re: Accelerated PyTorch Training on M1 Mac

#99
post #85

Earlier quoted context omitted.

The ANE only has support for calculations with fp16, int16 and int8 all of which are too small to train with (too much instability). A common thing to do is train in fp32 to be able to get the small differences and gradients and then once the model is frozen do inference on fp16 or bf16.

Using mixed precision training you can do most operations in fp16 and just a few in fp32 where it's needed. This is the norm for NVIDIA GPU training nowadays. For instance using fastai add `.to_fp16()` after your learner call, and that happens automatically.

How is the choice between fp16 and fp32 made? Is it like if any gradients in the tensor need the extra range you use fp32?

Re: Accelerated PyTorch Training on M1 Mac

#100
post #3

Exciting!! But don't see comparison with any laptop Nvidia GPUs in terms of performance. That would be insightful.

It compares unfavourably, but then again NVidia GPUs on laptop are massive powerhogs.

Do apple users really require the ability to train large ML models while mobile and without access to A/C power? Is this a real-world use case for the target market?
Post reply on HN