I wanted to share how I was able to install tensorflow-macos and tensorflow-metal with non-M1 Hardware.
Installing it on my M1 Mac Mini was straight forward with miniforge, but ran into issues with installation on my non-M1 device. (Also with miniforge)
Config:
- MacOS 11.3 Beta
- Radeon Vega Frontier
There's a workaround to installing from pip since it enforces platform checks.
- Download the whl files for tensorflow-macos and tensorflow-metal locally
- https://pypi.org/project/tensorflow-macos/#files
- https://pypi.org/project/tensorflow-metal/#files
- Rename the wheels:
tensorflow_macos-2.5.0-cp38-cp38-macosx_11_0_x86_64.whl ->tensorflow_macos-2.5.0-cp38-cp38-macosx_10_11_x86_64.whltensorflow_metal-0.1.1-cp38-cp38-macosx_11_0_x86_64.whl->tensorflow_metal-0.1.1-cp38-cp38-macosx_10_11_x86_64.whl
- Run
pip install /path/to/tensorflow_macos-2.5.0-cp38-cp38-macosx_10_11_x86_64.whl && pip install /path/to/tensorflow_metal-0.1.1-cp38-cp38-macosx_10_11_x86_64.whl
- Check whether GPU is detected:
python3 -c "import tensorflow as tf; physical_devices = tf.config.list_physical_devices('GPU'); print('Num GPUs:', len(physical_devices)); print(physical_devices)"
# > Init Plugin
# > Init Graph Optimizer
# > Init Kernel
# > Num GPUs: 1
# > [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
Hopefully this helps someone! I'm super stoked to finally get GPU support on MacOS