Mac M1 Native PyTorch


Performance Experiment Results

CIFAR 10 ResNet50 M1 Pro 8 Core M1 Pro 14 GCore NV 3070 Laptop NV A100-40g x1 NV A100-40g x8 NV A100-40g x16
Training Time (seconds/epoch) 240.17 104.70 (2.3x) 7.82 4.50 2.22 2.01
Test Acc (% after 20 epochs) 45.88 43.38 56.11 43.40 31.02 31.02
  • Environment
    • Code: Train a ResNet-50 classifier on CIFAR10
    • M1 Pro: PyTorch 1.12, Python 3.10
    • 3070 Laptop: cuda 11.6, PyTorch 1.11, Python 3.10
    • A100-40g: cuda 11.2, PyTorch1.11, Python 3.10, Distributed Data Parallel (DDP)
    • All results are averaged from 3 runs.

Install Conda

Verify conda platform is ARM

$ conda info

...
platform : osx-arm64
...

Create new environment and activate

$ conda create -n torch1.12 python=3.10 #name=torch1.12 with python3.10 
$ codna activate torch1.12 

Install PyTorch1.12

$ conda install pytorch torchvision -c pytorch-nightly
  • Install other packages
$ pip install notebook