Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created June 9, 2021 01:55
Show Gist options
  • Save MohamedElashri/a6f1cbca822de4a3b581ff77465e80b3 to your computer and use it in GitHub Desktop.
Save MohamedElashri/a6f1cbca822de4a3b581ff77465e80b3 to your computer and use it in GitHub Desktop.
tensorflow-metal on M1 #mac

tensorflow-metal

Accelerate training of machine learning models with TensorFlow right on your Mac. Install TensorFlow v2.5 and the tensorflow-metal PluggableDevice to accelerate training with Metal on Mac GPUs.

You can learn more about TensorFlow PluggableDevices here

OS Requirements

macOS 12.0+

Currently Not Supported

Multi-GPU support Acceleration for Intel GPUs V1 TensorFlow Networks

Installation

arm64 : M1

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

Install base tensorflow:

python -m pip install tensorflow-macos

Install metal plugin:

python -m pip install tensorflow-metal

@AlexVialaBellander
Copy link

Hi 👋
How would I get this to work within a virtual environment? Changing the source throws me out of the env (as expected).
Pardon my lack of knowledge.

Many thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment