How to run PyTorch, TensorFlow, and JAX on your Mac (Apple Silicon)
HTML-код
- Опубликовано: 6 фев 2025
- Link with instructions and code: github.com/svp...
I teach a live, interactive program that'll help you build production-ready Machine Learning systems from the ground up. Check it out here:
www.ml.school
To keep up with my content:
• Twitter/X: / svpino
• LinkedIn: / svpino
🔔 Subscribe for more stories: / @underfitted
Thank you for this video! For those, who wonder - on M1 Max 32gb RAM and 32 GPU cores - timings on CPU were 18ms (instead 14.4ms in video on M3 Max), but on GPU - 3.3ms - even slightly better.
yeah, same results..
may I ask what's the config for your jax-metal, jaxlib, and jax on your M1 mac? I can't generate random.PRNGKey on my M1.
Thank you for the specific install instructions. Python dependencies can be so tricky, and as you pointed out official docs are often incomplete
Hello Santiago, thank you very much for all of your super helpful videos. Your channel is my number one AI channel since months.
This time I got a problem installing tensorflow-metal on M3 Max Pro. The solution was to use Python 3.11 instead of 3.12. pyenv helped me a lot.
Awesome!
This channel is underrated
Indeed !
I saw you contents really relatable to me, new Subs here. I like exploring something new, just like you :D
Wow now my office's M1 ultra will be useful to train LLM. Thanks
lol...
Man this is very instructive video! Thank you for filming this!
Oh, cool, you already answered.Thanks a lot. I have another question concerning 5:25 min in the video. There you restart the jupyter kernel. The dialog even offers you "install" - why is this? Which jupyter notebook extension for VS code are you using? I just asked my colleague who is using jupyter notebooks often, but he is not doing this in VS code, so he also didn't know the answer as well. And in VS code I can find many jupyter plugins. At the moment I always start jupyter in the cmdline and insert the URL with the secret hash code. You always have such good ideas. I'm so happy that I found your channel.
getting the error: The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.
amazing stuff! you saved me a lot of frustration! thanks you soo much!
M3 Pro base configuration (PyTorch):
cpu: 18.6 ms
mps: 9.81 ms
Intel i7 MBP 16inch base model 2019
cpu: 114ms
mps on AMD 5300M: 7.57s
Looks like on the GPU front apple silicon still has a way to go for GPGPU using PyTorch. Looks like I'll save my money for now, sadly.
Amazing 👌
After installing tensorflow metal, do I have to always provide tf.device ? Will it automatically use GPU even if I don't mention it?
Any updates on M4? Or should we all stick to linux + NVIDIA?
❤❤❤❤super help
ok but how do you run this now??
How do I see pose lines on a body or bounding boxes?
In fact Metal 3 runs on AMD GPU Intel Macs as well
Dear sir, may I kindly ask you which model of Mac are you using? in terms of chip specs :)
Thanks a lot for the video!
M3
M3 Max with 128gb of ram
hey can u make tutorial how to install opencv library on mac? ive been trying and always failed.
what is the issue opencv is staright forward na.?
I installed it today: pip install works
I'm getting an error when trying to following your instructions: No matching distribution found for tensorflow-metal
Probably a Python version issue. I’m using 3.10
@@underfitted Agree. I specified python3.10 ($python3.10 -m venv .venv) when creating the virtual environment and was able to install tensorflow-metal. However, I'm getting a conflict on ml-dtypes-0.2.0 stating that tensorflow 2.16.1 requires ml-dtypes-0.3.2. I'll play around and see if that's a showstopper.
Edit: I see you got nearly the same conflict in the video. Should have watched the whole thing before commenting.
m4 with 16-core CPU and 40-core GPU
CPU: 12.9 ms
GPU: 2.58 ms
will this help for automatic1111
My Mac is M1 got it in 2021.
very interesting, how does this compare to typical Nvidia GPU like T4, L4 or consumer card like 4060, this will be useful for those who wants to know if they need a dedicate PC for this.
This is more like consumer cards (4080 or 4090)
@@underfitted really? I know the m3 Max is good, but at the 4080/4090 level? Really? How come on reddit most machinelearning people suggest not to use Mac but rather some cloud GPU or 3090? Is it because the pyTorch, TensorFlow, JAX were not really using the Apple GPU before?
Will this work on MacBook 2017?
No. This is for M-series Macs
great!
Nvidia RTX or Apple Silicon, which of these two is preferred for LLM applications?
100 percent Nvidia
TensorFlow won't work for most folks. Its support on mac metal is notoriously bad and outdated, there are plenty posts on StackOverflow and Reddit about this. You will have to manually match the versions of python and main libraries to have it work. Naive video...
Funny because my experience is completely the opposite. In all the work I do, TF is the one that has proved more reliable on Mac. Torch and Jax aren’t there yet.
this is just inference. not training
jax.random.PRNGKey generator seems does not compile properly on my M1 mac. My config is: jax-metal==0.0.3, jaxlib=0.4.10, jax==0.4.11, which is the suggested version from Apple. Did you face similar issue on M3?