Skip to content

Commit b738527

Browse files
committed
Try again
1 parent e0f66d0 commit b738527

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

.github/workflows/pull.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ jobs:
206206
conda activate "${CONDA_ENV}"
207207
208208
source .ci/scripts/utils.sh
209-
install_executorch "--use-pt-pinned-commit"
209+
install_executorch
210210
BUILD_TOOL="cmake"
211211
PYTHON_EXECUTABLE=python \
212212
bash .ci/scripts/build_llama_android.sh "${BUILD_TOOL}"
@@ -362,7 +362,7 @@ jobs:
362362
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
363363
conda activate "${CONDA_ENV}"
364364
365-
./install_requirements.sh --use-pt-pinned-commit
365+
./install_requirements.sh
366366
# build module for executorch.extension.pybindings.portable_lib
367367
bash test/build_size_test.sh
368368
strip cmake-out/test/size_test
@@ -398,7 +398,7 @@ jobs:
398398
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
399399
conda activate "${CONDA_ENV}"
400400
401-
./install_requirements.sh --use-pt-pinned-commit
401+
./install_requirements.sh
402402
403403
# build module for executorch.extension.pybindings.portable_lib
404404
bash test/build_size_test.sh
@@ -475,7 +475,7 @@ jobs:
475475
conda activate "${CONDA_ENV}"
476476
477477
source .ci/scripts/utils.sh
478-
install_executorch "--use-pt-pinned-commit"
478+
install_executorch
479479
480480
.ci/scripts/setup-arm-baremetal-tools.sh
481481
@@ -512,7 +512,7 @@ jobs:
512512
MODE=${{ matrix.mode }}
513513
PT2E_QUANTIZE=${{ matrix.pt2e_quantize }}
514514
515-
./install_requirements.sh --use-pt-pinned-commit
515+
./install_requirements.sh
516516
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
517517
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
518518
@@ -706,7 +706,7 @@ jobs:
706706
conda activate "${CONDA_ENV}"
707707
708708
source .ci/scripts/utils.sh
709-
install_executorch "--use-pt-pinned-commit"
709+
install_executorch
710710
711711
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-mediatek-deps.sh
712712
PYTHON_EXECUTABLE=python bash .ci/scripts/build-mediatek-sdk.sh

.github/workflows/trunk.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
conda activate "${CONDA_ENV}"
205205
206206
source .ci/scripts/utils.sh
207-
install_executorch "--use-pt-pinned-commit"
207+
install_executorch
208208
209209
.ci/scripts/setup-arm-baremetal-tools.sh
210210
@@ -235,7 +235,7 @@ jobs:
235235
conda activate "${CONDA_ENV}"
236236
237237
source .ci/scripts/utils.sh
238-
install_executorch "--use-pt-pinned-commit"
238+
install_executorch
239239
.ci/scripts/setup-arm-baremetal-tools.sh
240240
source examples/arm/ethos-u-scratch/setup_path.sh
241241
@@ -690,7 +690,7 @@ jobs:
690690
MODE=${{ matrix.mode }}
691691
PT2E_QUANTIZE=${{ matrix.pt2e_quantize }}
692692
693-
./install_requirements.sh --use-pt-pinned-commit
693+
./install_requirements.sh
694694
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-qnn-deps.sh
695695
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
696696

install_executorch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,13 @@ def main(args):
203203
os.environ["CMAKE_ARGS"] = " ".join(cmake_args)
204204

205205
check_and_update_submodules()
206+
# This option is used in CI to make sure that PyTorch build from the pinned commit
207+
# is used instead of release. CI jobs wouldn't be able to catch regression from the
208+
# latest PT commit otherwise
209+
use_pytorch_release = not args.use_pt_pinned_commit
206210

207211
# Step 1: Install core dependencies first
208-
install_requirements()
212+
install_requirements(use_pytorch_release)
209213

210214
# Step 2: Install core package
211215
cmd = (
@@ -226,7 +230,7 @@ def main(args):
226230

227231
# Step 3: Extra (optional) packages that is only useful for running examples.
228232
if not args.minimal:
229-
install_optional_example_requirements()
233+
install_optional_example_requirements(use_pytorch_release)
230234

231235

232236
if __name__ == "__main__":

install_requirements.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def python_is_compatible():
6262
TORCH_URL = "https://download.pytorch.org/whl/test/cpu"
6363

6464

65-
def install_requirements():
66-
# Error out on Intel macOS.
67-
if is_intel_mac_os():
65+
def install_requirements(use_pytorch_release):
66+
# Skip pip install on Intel macOS if using release
67+
if use_pytorch_release and is_intel_mac_os():
6868
print(
6969
"ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n"
7070
"Please build from source by following https://docs.pytorch.org/executorch/main/using-executorch-building-from-source.html",
@@ -74,7 +74,10 @@ def install_requirements():
7474

7575
# pip packages needed by exir.
7676
TORCH_PACKAGE = [
77-
"torch==2.8.0",
77+
# Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
78+
# that we don't need to set any version number there because they have already
79+
# been installed on CI before this step, so pip won't reinstall them
80+
"torch==2.8.0" if use_pytorch_release else "torch",
7881
]
7982

8083
# Install the requirements for core ExecuTorch package.
@@ -126,7 +129,7 @@ def install_requirements():
126129
)
127130

128131

129-
def install_optional_example_requirements():
132+
def install_optional_example_requirements(use_pytorch_release):
130133
print("Installing packages in requirements-examples.txt")
131134
subprocess.run(
132135
[
@@ -142,8 +145,8 @@ def install_optional_example_requirements():
142145

143146
print("Installing torch domain libraries")
144147
DOMAIN_LIBRARIES = [
145-
"torchvision==0.23.0",
146-
"torchaudio==2.8.0",
148+
"torchvision==0.23.0" if use_pytorch_release else "torchvision",
149+
"torchaudio==2.8.0" if use_pytorch_release else "torchaudio",
147150
]
148151
# Then install domain libraries
149152
subprocess.run(
@@ -172,15 +175,21 @@ def is_intel_mac_os():
172175

173176
def main(args):
174177
parser = argparse.ArgumentParser()
178+
parser.add_argument(
179+
"--use-pt-pinned-commit",
180+
action="store_true",
181+
help="build from the pinned PyTorch commit instead of nightly",
182+
)
175183
parser.add_argument(
176184
"--example",
177185
action="store_true",
178186
help="Also installs required packages for running example scripts.",
179187
)
180188
args = parser.parse_args(args)
181-
install_requirements()
189+
use_pytorch_release = not bool(args.use_pt_pinned_commit)
190+
install_requirements(use_pytorch_release)
182191
if args.example:
183-
install_optional_example_requirements()
192+
install_optional_example_requirements(use_pytorch_release)
184193

185194

186195
if __name__ == "__main__":

0 commit comments

Comments
 (0)