Around 1.5-2x improvement in training time over m1 cpu.
$ xcode-select --install
$ conda create -n torch-gpu python=3.8
$ conda activate torch-gpu
$ conda install pytorch torchvision torchaudio -c pytorch-nightly
# If not working with conda then try pip
$ pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
import torch
import math
# this ensures that the current MacOS version is at least 12.3+
print(torch.backends.mps.is_available())
# this ensures that the current current PyTorch installation was built with MPS activated.
print(torch.backends.mps.is_built())
$ curl — proto ‘=https’ — tlsv1.2 -sSf https://sh.rustup.rs | sh
$ pip install transformers
$ sh run.sh
System | Training Time (200 steps) |
---|---|
Kaggle P100 Notebook | ~32 sec |
Colab T4 Notebook | ~47 sec |
M1 GPU (Macbook pro 13 2020 model) | ~328 sec |
M1 CPU (Macbook pro 13 2020 model) | ~527 sec |
Kaggle CPU Notebook | ~1500 sec |