Skip to content

Commit a6328f0

Browse files
authored
Use pinned commit PyTorch on CI instead of nightly (pytorch#6564)
* Use pinned commit PyTorch on CI instead of nightly * Need to use a default value * Fix CI failures * Update PT pin * Fix libstdc++ installation * Use a higher timeout for some jobs * Fix review comments * Minor format fix * Add back the comment
1 parent 465170f commit a6328f0

File tree

8 files changed

+41
-20
lines changed

8 files changed

+41
-20
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bd5482c7c3e1197e10c46ff739027f917d9c1fcc
1+
23d590e518688f96e1d1947a08e9ca27df3e67e4

.ci/docker/common/install_clang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ install_ubuntu() {
1313
apt-get install -y --no-install-recommends clang-"$CLANG_VERSION"
1414
apt-get install -y --no-install-recommends llvm-"$CLANG_VERSION"
1515
# Also require LLD linker from llvm and libomp to build PyTorch from source
16-
apt-get install -y lld "libomp-${CLANG_VERSION}-dev"
16+
apt-get install -y lld "libomp-${CLANG_VERSION}-dev" "libc++-${CLANG_VERSION}-dev"
1717

1818
# Use update-alternatives to make this version the default
1919
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-"$CLANG_VERSION" 50

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mpmath==1.3.0
2-
numpy==1.22.0; python_version == '3.10'
2+
numpy==1.21.3; python_version == '3.10'
33
numpy==1.23.2; python_version == '3.11'
44
numpy; python_version >= '3.12'
55
PyYAML==6.0.1

.ci/scripts/setup-linux.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ else
1919
fi
2020

2121
# As Linux job is running inside a Docker container, all of its dependencies
22-
# have already been installed
23-
install_executorch
22+
# have already been installed, so we use PyTorch build from source here instead
23+
# of nightly. This allows CI to test against latest commits from PyTorch
24+
install_executorch "use-pt-pinned-commit"
2425
build_executorch_runner "${BUILD_TOOL}"

.ci/scripts/setup-qnn-deps.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ install_qnn() {
3131
}
3232

3333
setup_libc++() {
34+
clang_version=$1
3435
sudo apt-get update
35-
pkgs_to_check=('libc++-dev')
36+
pkgs_to_check=("libc++-${clang_version}-dev")
3637
j=0
3738
while [ $j -lt ${#pkgs_to_check[*]} ]; do
3839
install_status=$(verify_pkg_installed ${pkgs_to_check[$j]})
@@ -47,5 +48,6 @@ setup_libc++() {
4748
done
4849
}
4950

50-
setup_libc++
51+
# This needs to match with the clang version from the Docker image
52+
setup_libc++ 12
5153
install_qnn

.ci/scripts/utils.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ install_executorch() {
2020
which pip
2121
# Install executorch, this assumes that Executorch is checked out in the
2222
# current directory.
23-
# TODO(T199538337): clean up install scripts to use install_requirements.sh
24-
./install_requirements.sh --pybind xnnpack
23+
if [[ "${1:-}" == "use-pt-pinned-commit" ]]; then
24+
./install_requirements.sh --pybind xnnpack --use-pt-pinned-commit
25+
else
26+
./install_requirements.sh --pybind xnnpack
27+
fi
2528
# Just print out the list of packages for debugging
2629
pip list
2730
}

.github/workflows/trunk.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ jobs:
137137
docker-image: executorch-ubuntu-22.04-arm-sdk
138138
submodules: 'true'
139139
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
140+
timeout: 90
140141
script: |
141142
# The generic Linux job chooses to use base env, not the one setup by the image
142143
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
@@ -162,6 +163,7 @@ jobs:
162163
docker-image: executorch-ubuntu-22.04-arm-sdk
163164
submodules: 'true'
164165
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
166+
timeout: 90
165167
script: |
166168
# The generic Linux job chooses to use base env, not the one setup by the image
167169
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")

install_requirements.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def python_is_compatible():
6969
EXECUTORCH_BUILD_PYBIND = "OFF"
7070
CMAKE_ARGS = os.getenv("CMAKE_ARGS", "")
7171
CMAKE_BUILD_ARGS = os.getenv("CMAKE_BUILD_ARGS", "")
72+
USE_PYTORCH_NIGHTLY = True
7273

7374
for arg in sys.argv[1:]:
7475
if arg == "--pybind":
@@ -90,6 +91,11 @@ def python_is_compatible():
9091
shutil.rmtree(d, ignore_errors=True)
9192
print("Done cleaning build artifacts.")
9293
sys.exit(0)
94+
elif arg == "--use-pt-pinned-commit":
95+
# This option is used in CI to make sure that PyTorch build from the pinned commit
96+
# is used instead of nightly. CI jobs wouldn't be able to catch regression from the
97+
# latest PT commit otherwise
98+
USE_PYTORCH_NIGHTLY = False
9399
else:
94100
print(f"Error: Unknown option {arg}")
95101
sys.exit(1)
@@ -113,11 +119,27 @@ def python_is_compatible():
113119

114120
# pip packages needed by exir.
115121
EXIR_REQUIREMENTS = [
116-
f"torch==2.6.0.{NIGHTLY_VERSION}",
117-
f"torchvision==0.20.0.{NIGHTLY_VERSION}", # For testing.
122+
# Setting USE_PYTORCH_NIGHTLY to false to test the pinned PyTorch commit. Note
123+
# that we don't need to set any version number there because they have already
124+
# been installed on CI before this step, so pip won't reinstall them
125+
f"torch==2.6.0.{NIGHTLY_VERSION}" if USE_PYTORCH_NIGHTLY else "torch",
126+
(
127+
f"torchvision==0.20.0.{NIGHTLY_VERSION}"
128+
if USE_PYTORCH_NIGHTLY
129+
else "torchvision"
130+
), # For testing.
118131
"typing-extensions",
119132
]
120133

134+
# pip packages needed to run examples.
135+
# TODO: Make each example publish its own requirements.txt
136+
EXAMPLES_REQUIREMENTS = [
137+
"timm==1.0.7",
138+
f"torchaudio==2.5.0.{NIGHTLY_VERSION}" if USE_PYTORCH_NIGHTLY else "torchaudio",
139+
"torchsr==1.0.4",
140+
"transformers==4.42.4",
141+
]
142+
121143
# pip packages needed for development.
122144
DEVEL_REQUIREMENTS = [
123145
"cmake", # For building binary targets.
@@ -129,15 +151,6 @@ def python_is_compatible():
129151
"zstd", # Imported by resolve_buck.py.
130152
]
131153

132-
# pip packages needed to run examples.
133-
# TODO: Make each example publish its own requirements.txt
134-
EXAMPLES_REQUIREMENTS = [
135-
"timm==1.0.7",
136-
f"torchaudio==2.5.0.{NIGHTLY_VERSION}",
137-
"torchsr==1.0.4",
138-
"transformers==4.42.4",
139-
]
140-
141154
# Assemble the list of requirements to actually install.
142155
# TODO: Add options for reducing the number of requirements.
143156
REQUIREMENTS_TO_INSTALL = EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS

0 commit comments

Comments
 (0)