It seems the world of doing machine learning on an Apple M1-based computer is convoluted. This is a guide to sort out my thoughts and see what’s what. The key players seem to be:
- Accelerate Framework
- Core ML
- Framework for running neural networks on Apple Devices
- Tools for converting other trained networks from TensorFlow, PyTorch, etc. to Core ML format
- Refine pre-trained models to a specific user
- Interfaces with CPU, GPU, and Apple Neural Engine (ANE) to run inference
- Create ML
- Create Core ML models
- Train on the CPU and GPU
- Support for eGPU
- Seems to be pre-defined model architectures that you can choose from, and train to fit your needs such as image classification, learn an action from video, NLP, etc.
- Metal Performance Shaders
- Seems to be the generic Metal Shaders that can do graphics calculations as well as ML focused operations
- Metal Performance Shaders Graph
- Defines Metal compute kernels to run on the GPU in a graph(ical?) API
- An API that allows you to describe operations using a graph to describe a neural network (or a custom set of operations, within limits)
- Limited to pre-selected set of primitive operations, but can set up inference networks and training networks by adding gradient and loss operations.
- ML Compute
- Seems to be an over-arching framework that uses BNNS from the Accelerate Framework and MPS for the GPU
- Allows you to build network graphs, set up the optimizer, run the loss function, etc.
- tensorflow-metal
- Allows for network design and training by leveraging ML Compute framework
- Uses the CPU and GPU to accelerate training of BNNS on the CPU and MPS on the GPU
Some notes on Homebrew
- Originally installed Hombrew for ARM
- Had to remove that because UTM Windows 10 installer needed stuff in /usr/local, which is what Hombrew for x86 uses as the default location. Following instructions from this site and this stack-overflow.
- Might re-install the ARM one once completed.
- Had troubles with OpenSSH, used this link to fix. Just created symbolic link for one of the ISO Windows install tools.
Good resource on this info
Machine Think
Apple Neural Engine
Macrumors Forum on Apple M1 PyTorch
Apple Matrix Multiply vs ARM’s NEON