Following the instruction here Tensorflow Plugin - Metal - Apple Developer

Python (Miniforge)

First, we need to install miniforge. Easiest way to do that is to use pyenv. The tool allow us to install multiple version of pythons. More importantly, we can specify a version of python needed for each folder. Much more convinient than keep switching global versions

pyenv install miniforge3

mkdir demo-tensorflow-metal
pyenv local miniforge3

Install Tensorflow and it dependencies

conda install -c apple tensorflow-deps

python -m pip install tensorflow-macos
python -m pip install tensorflow-metal

Install and Run Jupyter

conda install jupyterlab

jupyter lab

Try MNIST demo

Simply follow along with Keras MNIST Demo

If everything is set up correctly, we should see that Metal Device is set to M1

Quite impressive performance from a fanless Macbook Air !

demo-tensorflow-metal/mnist.ipynb at main ยท varokas/demo-tensorflow-metal
Contribute to varokas/demo-tensorflow-metal development by creating an account on GitHub.

References