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

Комментарии • 49

  • @cherdak_turista
    @cherdak_turista 8 месяцев назад +6

    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.

    • @carlseghers7822
      @carlseghers7822 8 месяцев назад

      yeah, same results..

    • @ziweiyang2673
      @ziweiyang2673 8 месяцев назад

      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.

  • @justinhj1
    @justinhj1 8 месяцев назад +5

    Thank you for the specific install instructions. Python dependencies can be so tricky, and as you pointed out official docs are often incomplete

  • @uwegenosdude
    @uwegenosdude 7 месяцев назад +1

    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.

  • @modoulaminceesay9211
    @modoulaminceesay9211 8 месяцев назад +6

    This channel is underrated

  • @lutfiikbalmajid3128
    @lutfiikbalmajid3128 4 месяца назад

    I saw you contents really relatable to me, new Subs here. I like exploring something new, just like you :D

  • @swapwarick
    @swapwarick 8 месяцев назад +3

    Wow now my office's M1 ultra will be useful to train LLM. Thanks

  • @swibeijason
    @swibeijason 6 месяцев назад

    Man this is very instructive video! Thank you for filming this!

  • @uwegenosdude
    @uwegenosdude 7 месяцев назад

    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.

  • @immaculate6244
    @immaculate6244 5 дней назад

    getting the error: The TensorFlow library was compiled to use AVX instructions, but these aren't available on your machine.

  • @yuzaR-Data-Science
    @yuzaR-Data-Science 7 месяцев назад

    amazing stuff! you saved me a lot of frustration! thanks you soo much!

  • @Tarzan_of_the_Ocean
    @Tarzan_of_the_Ocean 7 месяцев назад +1

    M3 Pro base configuration (PyTorch):
    cpu: 18.6 ms
    mps: 9.81 ms

    • @michaellewis7087
      @michaellewis7087 6 месяцев назад

      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.

  • @relaxingnature7894
    @relaxingnature7894 Месяц назад

    Amazing 👌

  • @ananthkrish2634
    @ananthkrish2634 7 месяцев назад +1

    After installing tensorflow metal, do I have to always provide tf.device ? Will it automatically use GPU even if I don't mention it?

  • @retrocoolness9935
    @retrocoolness9935 2 месяца назад

    Any updates on M4? Or should we all stick to linux + NVIDIA?

  • @ziaulhoque5895
    @ziaulhoque5895 4 месяца назад

    ❤❤❤❤super help

  • @antdx316
    @antdx316 7 месяцев назад

    ok but how do you run this now??
    How do I see pose lines on a body or bounding boxes?

  • @3a146
    @3a146 8 месяцев назад

    In fact Metal 3 runs on AMD GPU Intel Macs as well

  • @dmitrykomarov6152
    @dmitrykomarov6152 8 месяцев назад

    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!

  • @rrivaldi
    @rrivaldi 8 месяцев назад +1

    hey can u make tutorial how to install opencv library on mac? ive been trying and always failed.

    • @abhiramk_6
      @abhiramk_6 8 месяцев назад +1

      what is the issue opencv is staright forward na.?

    • @underfitted
      @underfitted  8 месяцев назад

      I installed it today: pip install works

  • @mike110111
    @mike110111 8 месяцев назад +1

    I'm getting an error when trying to following your instructions: No matching distribution found for tensorflow-metal

    • @underfitted
      @underfitted  8 месяцев назад

      Probably a Python version issue. I’m using 3.10

    • @jbgreer
      @jbgreer 8 месяцев назад

      @@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.

  • @AJ-ju7tl
    @AJ-ju7tl Месяц назад +1

    m4 with 16-core CPU and 40-core GPU
    CPU: 12.9 ms
    GPU: 2.58 ms

  • @concept-theory
    @concept-theory 6 месяцев назад

    will this help for automatic1111

  • @geekyprogrammer4831
    @geekyprogrammer4831 8 месяцев назад

    My Mac is M1 got it in 2021.

  • @IsaacFromHK
    @IsaacFromHK 7 месяцев назад

    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.

    • @underfitted
      @underfitted  7 месяцев назад

      This is more like consumer cards (4080 or 4090)

    • @IsaacFromHK
      @IsaacFromHK 7 месяцев назад +1

      @@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?

  • @adesojialu1051
    @adesojialu1051 8 месяцев назад

    Will this work on MacBook 2017?

    • @underfitted
      @underfitted  8 месяцев назад +1

      No. This is for M-series Macs

  • @이동혁-p9z
    @이동혁-p9z 7 месяцев назад

    great!

  • @kannansingaravelu
    @kannansingaravelu 8 месяцев назад

    Nvidia RTX or Apple Silicon, which of these two is preferred for LLM applications?

  • @1sefirot9
    @1sefirot9 8 месяцев назад

    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...

    • @underfitted
      @underfitted  8 месяцев назад +1

      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.

  • @Cat-vs7rc
    @Cat-vs7rc 3 месяца назад +2

    this is just inference. not training

  • @ziweiyang2673
    @ziweiyang2673 8 месяцев назад

    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?