Live data from Hacker News

Accelerated PyTorch Training on M1 Mac

pytorch.org

121–130 of 153 posts

Re: Accelerated PyTorch Training on M1 Mac

#121
post #111

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…

it took me 20 years to learn this body of knowledge and now it can just sort of be summed up in a paragraph. When I learned and used gradient descent, you had to analytically determine your own gradients ( https://web.archive.org/web/20161028022707/https://genomics.... ). I went to grad school to learn how to determine my own gradients. Unfortunately, in my realm, loss landscapes have multiple minima, and gradient de…

What's your realm?

Re: Accelerated PyTorch Training on M1 Mac

#122
post #30

Earlier quoted context omitted.

Probably because it will be impossible to compare with old results. If every year the community chooses a different model, how are you going to compare results year over year?

The numbers are relative speedups, not absolute numbers that can be compared with any prior results, so I don't really see how this matters.

You need something constant, either the model or the hardware, otherwise you cannot have those relative numbers. And you usually want to have a trend. See my other reply

Re: Accelerated PyTorch Training on M1 Mac

#123
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!).

> But why are people still reporting benchmark results on VGG? It makes me feel like i’m missing something! Is is still used as a backbone in the same way as legacy code is everywhere, or is it something else entirely??

VGG works better for style transfer than ResNet (this is a surprising result, but empirically true), but that's the only case I am aware of.

https://arxiv.org/abs/2104.05623

Re: Accelerated PyTorch Training on M1 Mac

#124
post #62
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…

> but they're already way ahead on energy efficiency 1) Nope. For neural network training not the case: https://tlkh.dev/benchmarking-the-apple-m1-max And that's with the 3090 set at a very high 400W power limit, can get far more efficient when clocked lower. (which is normal, because no dedicated matrix math accelerators on the GPU notably) 2) We'll see, hopefully Apple thinks that the market is worth bothering with…

What do you mean by: "if you can stand Metal for your use case?" What is Metal?

Re: Accelerated PyTorch Training on M1 Mac

#125

Earlier quoted context omitted.

Question about terminology (no background in AI). In econometrics, estimation is model fitting (training, I guess), and inference refers to hypothesis testing (e.g. t or F tests). What does inference mean here?

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…

Thanks for the explanation, really succinct. Do you recommend any good back propagation tutorials for an EE undergrad?

Re: Accelerated PyTorch Training on M1 Mac

#126
post #62

Earlier quoted context omitted.

> but they're already way ahead on energy efficiency 1) Nope. For neural network training not the case: https://tlkh.dev/benchmarking-the-apple-m1-max And that's with the 3090 set at a very high 400W power limit, can get far more efficient when clocked lower. (which is normal, because no dedicated matrix math accelerators on the GPU notably) 2) We'll see, hopefully Apple thinks that the market is worth bothering with…

What do you mean by: "if you can stand Metal for your use case?" What is Metal?

Metal is apple’s api for writing software that uses their GPUs.

https://en.m.wikipedia.org/wiki/Metal_(API)

Re: Accelerated PyTorch Training on M1 Mac

#127
post #62

Earlier quoted context omitted.

> but they're already way ahead on energy efficiency 1) Nope. For neural network training not the case: https://tlkh.dev/benchmarking-the-apple-m1-max And that's with the 3090 set at a very high 400W power limit, can get far more efficient when clocked lower. (which is normal, because no dedicated matrix math accelerators on the GPU notably) 2) We'll see, hopefully Apple thinks that the market is worth bothering with…

What do you mean by: "if you can stand Metal for your use case?" What is Metal?

[deleted]

Re: Accelerated PyTorch Training on M1 Mac

#128
post #117
post #114

Earlier quoted context omitted.

Grouped convolutions can't really run faster than groups * conv(ch/group) and I believe that's close to where they're at? Note that for ch So unfortunately depthwise convolutions end up having terrible performance.

Why wouldn’t you be able to run them in parallel using CUDA? You shouldn’t be memory-transfer speed limited when group convolution layers are a part of a bigger net. Note that pointwise 1x1 convolutions are a special case of group convolutions and actually I think they might be specially optimized in PyTorch (I’d have to run some benchmarks to test it though).

pointwise isn’t a case of grouped conv, they’re orthogonal ideas.

You can fuse grouped convs (depthwise is a special case of grouped convs) into preceding or following layers. Maybe JAX can do this already? No clue if any library offers such an optimization out of the box

Re: Accelerated PyTorch Training on M1 Mac

#129
Anyone actually got this to run on an M1 Mac?

    $ conda install pytorch torchvision torchaudio -c pytorch-nightly
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Collecting package metadata (repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.

    PackagesNotFoundError: The following packages are not available from current channels:

      - torchaudio
And the pip install variant installs an old version of torchaudio that is broken

    OSError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/test123/lib/python3.10/site-packages/torchaudio/lib/libtorchaudio.so, 0x0006): Symbol not found: __ZN2at14RecordFunctionC1ENS_11RecordScopeEb

Re: Accelerated PyTorch Training on M1 Mac

#130

Does this work on any Metal hardware or just the M1 GPU?

This is targeting AMD GPUs and M1 GPUs currently not targeting the integrated Intel GPUs present in Intel machines. However if you have a 16 inch Intel MBP, or a Mac Pro, etc, this should work with your AMD GPUs. That support isn’t in the nightly packages yet (only Apple Silicon support so far) but the PyTorch team is saying that it will be available by the end of the week hopefully. If you just can’t wait, you should be able to build from source to test it out right now.
Post reply on HN