forked from pytorch/builder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_m1_domains.sh
executable file
·45 lines (39 loc) · 1.89 KB
/
build_m1_domains.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/zsh
# Script used to build domain libraries wheels for M1
source ~/miniconda3/etc/profile.d/conda.sh
set -ex
TORCH_VERSION=1.11.0
TORCHVISION_VERSION=0.12.0
TORCHAUDIO_VERSION=0.11.0
TORCHTEXT_VERSION=0.12.0
for PYTHON_VERSION in 3.8 3.9 3.10; do
PY_VERSION=${PYTHON_VERSION/.}
conda create -yn whl-py${PY_VERSION}-torch-${TORCH_VERSION} python=${PYTHON_VERSION} numpy libpng openjpeg wheel pkg-config
conda activate whl-py${PY_VERSION}-torch-${TORCH_VERSION}
python3 -mpip install torch --extra-index-url=https://download.pytorch.org/whl/test torch==${TORCH_VERSION}
python3 -mpip install delocate
pushd ~/git/pytorch/vision
git checkout release/${TORCHVISION_VERSION%.*}
rm -rf build
BUILD_VERSION=${TORCHVISION_VERSION} python3 setup.py bdist_wheel
WHL_NAME=torchvision-${TORCHVISION_VERSION}-cp${PY_VERSION}-cp${PY_VERSION}-macosx_11_0_arm64.whl
DYLD_FALLBACK_LIBRARY_PATH="$(dirname $(dirname $(which python)))/lib" delocate-wheel -v --ignore-missing-dependencies dist/${WHL_NAME}
python3 -mpip install dist/${WHL_NAME}
popd
pushd ~/git/pytorch/audio
git checkout release/${TORCHAUDIO_VERSION%.*}
rm -rf build
BUILD_VERSION=${TORCHAUDIO_VERSION} python3 setup.py bdist_wheel
WHL_NAME=torchaudio-${TORCHAUDIO_VERSION}-cp${PY_VERSION}-cp${PY_VERSION}-macosx_11_0_arm64.whl
python3 -mpip install dist/${WHL_NAME}
popd
pushd ~/git/pytorch/text
git checkout release/${TORCHTEXT_VERSION%.*}
rm -rf build
BUILD_VERSION=${TORCHTEXT_VERSION} python3 setup.py bdist_wheel
WHL_NAME=torchtext-${TORCHTEXT_VERSION}-cp${PY_VERSION}-cp${PY_VERSION}-macosx_11_0_arm64.whl
python3 -mpip install dist/${WHL_NAME}
popd
python -c "import torch;import torchvision;print('Is torchvision useable?', all(x is not None for x in [torch.ops.image.decode_png, torch.ops.torchvision.roi_align]))"
python -c "import torch;import torchaudio;torchaudio.set_audio_backend('sox_io')"
done