Leveraging ML Compute Framework For Accelerated TensorFlow Performance On Mac

TensorFlow 2 offers best-in-class training performance on various platforms, devices, and hardware. This empowers researchers and professionals to work on their favored platform. TensorFlow users on Intel Macs or Macs powered by Apple’s new M1 chip can now benefit from accelerated training using Apple’s Mac-optimized version of TensorFlow 2.4 and the new machine learning (ML) Compute framework. Tensor’s ability to support high-performance machine learning execution on Apple hardware has been enhanced with these improvements and Apple developers’ ability to execute TensorFlow on iOS through TensorFlow Lite.

Training performance on the Mac with ML Compute framework

The Mac has been prominent among developers and researchers. Formerly, TensorFlow has only used the CPU for training on Mac. The new updated version of Mac contains the new M1 chip. Apple’s Mac-optimized version of TensorFlow 2.4 leverages Mac’s full power with a significant performance improvement. 

ML Compute is Apple’s new framework that powers training for TensorFlow models on the Mac. TensorFlow 2.4 has a new tensorflow_macos fork that leverages ML Compute. It enables ML libraries to take complete advantage of the CPU and the GPU in both M1- and Intel-powered Macs. It begins with implementing higher-level optimizations such as fusing layers, selecting the suitable device type, organizing and executing the graph as primitives stimulated by BNNS on the CPU, and Metal Performance Shaders on the GPU. The M1 chip includes a robust new 8-Core CPU and up to 8-core GPU optimized for ML training tasks right on the Mac. 

Graphs show how Mac-optimized TensorFlow 2.4 delivers substantial performance increases on M1- and Intel-powered Macs with leading models.


The graph shows the Training impact on standard models using ML Compute on M1- and Intel-powered 13-inch MacBook Pro in seconds per batch. The lower numbers indicate faster training time.


Graph shows the Training impact on standard models using ML Compute on the Intel-powered 2019 Mac Pro in seconds per batch. The lower numbers indicate faster training time.

Starting with Mac-optimized TensorFlow

To use ML Compute as a back-end for TensorFlow and TensorFlow Addons, users do not require any changes to their current TensorFlow scripts. Users can visit Apple’s GitHub repo and go through the instructions to download and install the Mac-optimized TensorFlow 2.4 fork.

The team aims to make additional updates for users to get these performance figures by integrating the forked version into the TensorFlow master branch.

Source: https://blog.tensorflow.org/2020/11/accelerating-tensorflow-performance-on-mac.html

Reference: https://machinelearning.apple.com/updates/ml-compute-training-on-mac

Github: https://github.com/apple/tensorflow_macos

🐝 Join the Fastest Growing AI Research Newsletter Read by Researchers from Google + NVIDIA + Meta + Stanford + MIT + Microsoft and many others...