Install native ARM R: https://cloud.r-project.org/
Install RStudio (probably preview) which is not native as of today: https://www.rstudio.com/products/rstudio/download/preview/
This blog post is helpful for getting Tensorflow working, but it is older, before the ARM version of R and the RStudio version that supports it was available.
This other blog post has specific steps outlined, but some of it has also been superseded.
Looks to me like Apple's instructions are the best as of today: https://developer.apple.com/metal/tensorflow-plugin/
Here is what I think you need to do:
- Make sure you have Python 3.8 or Python 3.9
- Install Miniforge for ARM, using
reticulate::install_miniconda()
from within R - Create conda environment for your TensorFlow install (I called it
tf_env
and have had better luck doing it from the command line) - Install packages like numpy, pandas, etc for ARM (try it with
conda install -c apple tensorflow-deps
from Apple's instructions? is that good enough?) - Install base Tensorflow (I have not tried the
tensorflow-metal
yet)
You can turn it on (in the terminal) with conda activate tf_env
and turn it off with conda deactivate
. I have this in my .Renviron
:
RETICULATE_PYTHON = "~/miniforge3/envs/tf_env/bin/python"
Hi @t-kalinowski - Thanks for providing the steps above. I ran them successfully in my mac m1. And, I am now running some models in RStudio (ebecht/infinityFlow#13).
In my Activity Monitor, it does show GPU % below and when I tried to run some functions in R-Studio, it shows below. Does that means it is working, even though the warning "Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support" is still there?
Thank you for your help!
Related: rstudio/tensorflow#555