Skip to content

Commit 6e94da7

Browse files
update workflow and scripts for arm64
1 parent e369831 commit 6e94da7

File tree

2 files changed

+81
-9
lines changed

2 files changed

+81
-9
lines changed

.github/workflows/build_wheel_windows_arm64.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Torchvision Windows ARM64 Wheels
1+
name: Build Windows ARM64 Wheels
22

33
on:
44
pull_request:
@@ -19,12 +19,12 @@ permissions:
1919

2020
jobs:
2121
generate-matrix:
22-
uses: alinpahontu2912/test-infra/.github/workflows/generate_binary_build_matrix.yml@winarm64_wheels
22+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
2323
with:
2424
package-type: wheel
2525
os: windows-arm64
26-
test-infra-repository: alinpahontu2912/test-infra
27-
test-infra-ref: winarm64_wheels
26+
test-infra-repository: pytorch/test-infra
27+
test-infra-ref: main
2828
with-cuda: disable
2929

3030
build:
@@ -35,17 +35,19 @@ jobs:
3535
include:
3636
- repository: pytorch/vision
3737
smoke-test-script: test/smoke_test.py
38+
pre-script: packaging/pre_build_script_arm64.sh
3839
package-name: torchvision
39-
architecture: arm64
40+
architecture: "arm64"
4041
name: ${{ matrix.repository }}
41-
uses: alinpahontu2912/test-infra/.github/workflows/build_wheels_windows.yml@winarm64_wheels
42+
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
4243
with:
4344
repository: ${{ matrix.repository }}
4445
ref: ""
45-
test-infra-repository: alinpahontu2912/test-infra
46-
test-infra-ref: winarm64_wheels
46+
test-infra-repository: pytorch/test-infra
47+
test-infra-ref: main
48+
pre-script: ${{ matrix.pre-script }}
4749
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
4850
package-name: ${{ matrix.package-name }}
4951
smoke-test-script: ${{ matrix.smoke-test-script }}
5052
trigger-event: ${{ github.event_name }}
51-
architecture: ${{ matrix.architecture }}
53+
architecture: ${{ matrix.architecture }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
3+
echo "Building vision dependencies and wheel started."
4+
5+
# Set environment variables
6+
export SRC_PATH="$GITHUB_WORKSPACE/$SRC_DIR"
7+
export CMAKE_BUILD_TYPE="$BUILD_TYPE"
8+
export VCVARSALL_PATH="$DEPENDENCIES_DIR/VSBuildTools/VC/Auxiliary/Build/vcvarsall.bat"
9+
export CONDA_PREFIX="$DEPENDENCIES_DIR"
10+
export PATH="$PATH:$CONDA_PREFIX/Library/bin"
11+
export DISTUTILS_USE_SDK=1
12+
export TRIPLET_FILE="triplets/arm64-windows.cmake"
13+
export PYTORCH_VERSION="$PYTORCH_VERSION"
14+
export CHANNEL="$CHANNEL"
15+
16+
echo "channel: $CHANNEL"
17+
18+
# Dependencies
19+
mkdir -p "$DOWNLOADS_DIR"
20+
mkdir -p "$DEPENDENCIES_DIR"
21+
echo "*" > "$DOWNLOADS_DIR/.gitignore"
22+
echo "*" > "$DEPENDENCIES_DIR/.gitignore"
23+
24+
# Install vcpkg
25+
cd "$DOWNLOADS_DIR" || exit
26+
git clone https://github.com/microsoft/vcpkg.git
27+
cd vcpkg || exit
28+
./bootstrap-vcpkg.sh
29+
30+
# # Set vcpkg to only build release packages
31+
echo "set(VCPKG_BUILD_TYPE release)" >> "$TRIPLET_FILE"
32+
33+
# Install dependencies using vcpkg
34+
./vcpkg install libjpeg-turbo:arm64-windows --x-install-root="$DEPENDENCIES_DIR"
35+
./vcpkg install libwebp:arm64-windows --x-install-root="$DEPENDENCIES_DIR"
36+
./vcpkg install libpng[tools]:arm64-windows --x-install-root="$DEPENDENCIES_DIR"
37+
38+
# Copy files using cp (replace robocopy)
39+
cp "$DEPENDENCIES_DIR/arm64-windows/lib/libpng16.lib" "$DEPENDENCIES_DIR/arm64-windows/lib/libpng.lib"
40+
cp "$DEPENDENCIES_DIR/arm64-windows/bin/libpng16.dll" "$DEPENDENCIES_DIR/arm64-windows/bin/libpng.dll"
41+
cp "$DEPENDENCIES_DIR/arm64-windows/bin/libpng16.pdb" "$DEPENDENCIES_DIR/arm64-windows/bin/libpng.pdb"
42+
mkdir -p "$DEPENDENCIES_DIR/Library/"
43+
cp -r "$DEPENDENCIES_DIR/arm64-windows/"* "$DEPENDENCIES_DIR/Library/"
44+
cp -r "$DEPENDENCIES_DIR/Library/tools/libpng/"* "$DEPENDENCIES_DIR/Library/bin/"
45+
cp -r "$DEPENDENCIES_DIR/Library/bin/"* "$SRC_PATH/torchvision"
46+
47+
# Source directory
48+
cd "$SRC_PATH" || exit
49+
50+
# Create virtual environment
51+
python -m pip install --upgrade pip
52+
python -m venv .venv
53+
echo "*" > .venv/.gitignore
54+
source .venv/Scripts/activate
55+
56+
# Install dependencies
57+
pip install numpy==2.2.3
58+
59+
if [ "$CHANNEL" = "release" ]; then
60+
echo "Installing latest stable version of PyTorch."
61+
pip3 install torch
62+
elif [ "$CHANNEL" = "test" ]; then
63+
echo "Installing PyTorch version $PYTORCH_VERSION."
64+
pip3 install torch=="$PYTORCH_VERSION"
65+
else
66+
echo "CHANNEL is not set, installing PyTorch from nightly."
67+
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
68+
fi
69+
70+
echo "Dependencies install finished successfully."

0 commit comments

Comments
 (0)