Giter Club home page Giter Club logo

tensorflow-installation-guide-for-apple-silicon-macs's Introduction

Tensorflow-Installation-guide-for-Apple-silicon-Macs

This is a step-by-step guide for people who want to install Tensorflow modules on M1 Mac. You can now leverage Apple’s tensorflow-metal PluggableDevice in TensorFlow v2.5 for accelerated training on Mac GPUs directly with Metal

1*nzaiZv6656n20mLw8Sv7Vw

Using the conventional installation method will return a dead kernal❗️

Screen Shot 2022-03-14 at 16 46 09

Reference Articles: How To Install TensorFlow on M1 Mac (The Easy Way) | by Prabhat Kumar Sahu | Medium Tensorflow Plugin - Metal - Apple Developer

Step 1: Install Homebrew

Go to the website The Missing Package Manager for macOS (or Linux) — Homebrew, copy the following into terminal:

Screen Shot 2022-03-14 at 16 30 46

Screen Shot 2022-03-14 at 17 01 50

Step 2: Install Xcode by typing the following in terminal

xcode-select --install

Step 3: Install Miniforge

Download “Conda env” from the link, drag it to your download folder Tensorflow Plugin - Metal - Apple Developer

Screen Shot 2022-03-14 at 16 34 50

Follow the instructions on the web: copy the codes into terminal: Screen Shot 2022-03-14 at 16 36 23

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh

sh ~/Downloads/Miniforge3-MacOSX-arm64.sh

Screen Shot 2022-03-14 at 16 38 27

Keep pressing yes/return to proceed with the installation, until it ask you “Do you wish the installer to initialize Miniforge3?” I typed no as I don’t want it to initialize every time.

Step 4: Activate the new environment miniforge3 that we have just created, then install tensorflow

source ~/miniforge3/bin/activate

conda install -c apple tensorflow-deps

python -m pip install tensorflow-macos

python -m pip install tensorflow-metal

conda install -c conda-forge -y pandas jupyter

conda install numpy

(At a later stage it may complain not having NumPy so we can install it beforehand)

Step 5: Launch Jupiter notebook and test it out

jupyter notebook

In the notebook, try the following:

import tensorflow as tf

print(“Num GPUs Available: “, len(tf.config.experimental.list_physical_devices(‘GPU’)))

It should not return any error ✅✅✅

Screen Shot 2022-03-14 at 16 44 56

Remember to activate this environment everytime you wanted to use tensorflow, Using the default one with Anaconda will always return me a dead kernel once I started to import tensorflow in Jupiter notebook

source ~/miniforge3/bin/activate jupiter notebook

You can always check the python and see which direcotry it's pointing. I have Anaconda3 to initialize everytime and it's required to activate miniforge3 to get tensorflow working

Screen Shot 2022-03-14 at 16 54 28

tensorflow-installation-guide-for-apple-silicon-macs's People

Contributors

au-jonathan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.