Apple Silicon install Metal API supported Tensorflow

Here is a direction on adopting accelerate training of machine learning models with TensorFlow on the Mac, by the installation of TensorFlow and the tensorflow-metal PluggableDevice to accelerate training with Metal on M1 Mac GPUs.

Here is a direction on adopting accelerate training of machine learning models with TensorFlow on the Mac, by the installation of TensorFlow and the tensorflow-metal PluggableDevice to accelerate training with Metal on M1 Mac GPUs.

Installation Instructions

If you have conda installed, please jump over this procedure:

Download and install Conda env:
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
Install the TensorFlow dependencies:
conda install -c apple tensorflow-deps
tensorflow-deps versions are following base TensorFlow versions so:
  • For v2.5:
conda install -c apple tensorflow-deps==2.5.0
  • For v2.6:
conda install -c apple tensorflow-deps==2.6.0

NOTE: python versions 3.8 and 3.9 supported

Install base tensorflow-macos
python -m pip install tensorflow-macos
Install tensorflow-metal plugin
python -m pip install tensorflow-metal

Now, you have the Metal API supported Tensorflow on your Apple Silicon Mac!