Initializing-TensorFlow-Environment-on-M3-M3-Pro-and-M3-Max-Macbook-Pros.
Initializing-TensorFlow-Environment-on-M3-M3-Pro-and-M3-Max-Macbook-Pros. copied to clipboard
Unlock the full potential of your Apple Silicon-powered M3, M3 Pro, and M3 Max MacBook Pros by leveraging TensorFlow, the open-source machine learning framework. This repository is tailored to provide...
Initializing TensorFlow Environment on M3, M3 Pro and M3 Max Macbook Pros.
TensorFlow on M3, M3 Pro, and M3 Max MacBook Pros: Harnessing Computational Power with Apple Silicon
Description:
Unlock the full potential of your Apple Silicon-powered M3, M3 Pro, and M3 Max MacBook Pros by leveraging TensorFlow, the open-source machine learning framework. This repository is tailored to provide an optimized environment for setting up and running TensorFlow on Apple's cutting-edge M3 chips.
Key Features:
-
Efficient ML Workflows: Streamline your machine learning workflows on Apple Silicon for enhanced efficiency and performance.
-
Tailored Configurations: Discover configurations and settings specifically designed for M3, M3 Pro, and M3 Max MacBook Pros, ensuring optimal resource utilization.
-
Performance Boost: Leverage the native capabilities of Apple Silicon to achieve accelerated training and inference speeds, tapping into the computational prowess of your M3 MacBook Pro.
-
Compatibility and Updates: Stay up-to-date with the latest TensorFlow releases and compatibility updates tailored for Apple Silicon architecture.
Getting Started: Follow all the necessary steps mentioned below.
Steps
- Install Homebrew from https://brew.sh.
- Download Miniforge3 for macOS arm64 chips.
- Install Miniforge3 into the home directory of your Macbook Pro.
- Type the following Bash code in the terminal.
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
- Restart terminal to prevent any errors.
- Create a new directory to setup the custom TensorFlow environment.
mkdir tensorflow-test
cd tensorflow-test
- Type ls in terminal to crosscheck the current directory.
- Initialize and activate the Conda environment.
conda create --prefix ./env python=3.8
conda activate ./env
- Install TensorFlow dependencies from Apple Conda.
conda install -c apple tensorflow-deps
- Install base TensorFlow.
python -m pip install tensorflow-macos
- Install Apple's
tensorflow-metal
to utilize the Apple Metal (Apple's GPU framework) for M3, M3 Pro, M3 Max GPU access.
python -m pip install tensorflow-metal
- Install data science packages.
conda install jupyter pandas numpy matplotlib scikit-learn
- Start Jupyter Notebook.
jupyter notebook
- Type the following code to check TensorFlow version/GPU access.
import numpy as np
import pandas as pd
import sklearn
import tensorflow as tf
import matplotlib.pyplot as plt
# Check for TensorFlow GPU access
print(f"TensorFlow has access to the following devices:\n{tf.config.list_physical_devices()}")
# See TensorFlow version
print(f"TensorFlow version: {tf.__version__}")
That's It!!
You should now be able to run all your ML models on Apple's GPU.
Thank You.