Skip to content

Commit acfefa2

Browse files
committed
Fix BC break: ShapeEnv.size_hint renamed to guarding_hint_or_throw
PyTorch renamed ShapeEnv.size_hint() to guarding_hint_or_throw(). Use hasattr to support both old and new PyTorch versions. This diff was authored with Claude.
1 parent e972e08 commit acfefa2

File tree

9 files changed

+30
-38
lines changed

9 files changed

+30
-38
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a79095985ccd3a645bd2fc31c5ae4fcf215ef518
1+
release/2.11

.ci/docker/common/install_pytorch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ install_pytorch_and_domains() {
3232
pip_install "$(echo dist/*.whl)"
3333

3434
# Grab the pinned audio and vision commits from PyTorch
35-
TORCHAUDIO_VERSION=$(cat .github/ci_commit_pins/audio.txt)
35+
TORCHAUDIO_VERSION=release/2.11
3636
export TORCHAUDIO_VERSION
37-
TORCHVISION_VERSION=$(cat .github/ci_commit_pins/vision.txt)
37+
TORCHVISION_VERSION=release/0.26
3838
export TORCHVISION_VERSION
3939

4040
install_domains

.ci/scripts/test_model_e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ if [ "$AUDIO_URL" != "" ]; then
248248
elif [[ "$MODEL_NAME" == *whisper* ]] || [ "$MODEL_NAME" = "voxtral_realtime" ]; then
249249
conda install -y -c conda-forge "ffmpeg<8"
250250
pip install datasets soundfile
251-
pip install torchcodec==0.11.0.dev20260310 --extra-index-url https://download.pytorch.org/whl/nightly/cpu
251+
pip install torchcodec==0.11.0 --extra-index-url https://download.pytorch.org/whl/test/cpu
252252
python -c "from datasets import load_dataset;import soundfile as sf;sample = load_dataset('distil-whisper/librispeech_long', 'clean', split='validation')[0]['audio'];sf.write('${MODEL_DIR}/$AUDIO_FILE', sample['array'][:sample['sampling_rate']*30], sample['sampling_rate'])"
253253
fi
254254

.ci/scripts/test_wheel_package_qnn.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,18 @@ print(module_vars["TORCH_VERSION"])
158158
PY
159159
)
160160

161-
NIGHTLY_VERSION=$(
162-
"$PYBIN" - <<'PY'
163-
import runpy
164-
module_vars = runpy.run_path("torch_pin.py")
165-
print(module_vars["NIGHTLY_VERSION"])
166-
PY
167-
)
168-
echo "=== [$LABEL] Install torch==${TORCH_VERSION}.${NIGHTLY_VERSION} ==="
161+
# NIGHTLY_VERSION=$(
162+
# "$PYBIN" - <<'PY'
163+
# import runpy
164+
# module_vars = runpy.run_path("torch_pin.py")
165+
# print(module_vars["NIGHTLY_VERSION"])
166+
# PY
167+
# )
168+
169+
echo "=== [$LABEL] Install torch==${TORCH_VERSION} ==="
169170

170171
# Install torchao based on the pinned PyTorch version
171-
"$PIPBIN" install torch=="${TORCH_VERSION}.${NIGHTLY_VERSION}" --index-url "https://download.pytorch.org/whl/nightly/cpu"
172+
"$PIPBIN" install torch=="${TORCH_VERSION}" --index-url "https://download.pytorch.org/whl/test/cpu"
172173
"$PIPBIN" install wheel
173174

174175
# Install torchao based on the pinned commit from third-party/ao submodule

.ci/scripts/utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ install_pytorch_and_domains() {
141141

142142
dedupe_macos_loader_path_rpaths
143143
# Grab the pinned audio and vision commits from PyTorch
144-
TORCHAUDIO_VERSION=$(cat .github/ci_commit_pins/audio.txt)
144+
TORCHAUDIO_VERSION=release/2.11
145145
export TORCHAUDIO_VERSION
146-
TORCHVISION_VERSION=$(cat .github/ci_commit_pins/vision.txt)
146+
TORCHVISION_VERSION=release/0.26
147147
export TORCHVISION_VERSION
148148

149149
install_domains

examples/models/moshi/mimi/install_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
set -x
99

1010
sudo apt install ffmpeg -y
11-
pip install torchcodec==0.11.0.dev20260310 --extra-index-url https://download.pytorch.org/whl/nightly/cpu
11+
pip install torchcodec==0.11.0 --extra-index-url https://download.pytorch.org/whl/test/cpu
1212
pip install moshi==0.2.11
1313
pip install bitsandbytes soundfile einops
1414
# Run llama2/install requirements for torchao deps

install_requirements.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
from install_utils import determine_torch_url, is_intel_mac_os, python_is_compatible
1414

15-
from torch_pin import NIGHTLY_VERSION, TORCH_VERSION
15+
from torch_pin import TORCH_VERSION
1616

1717
# The pip repository that hosts nightly torch packages.
1818
# This will be dynamically set based on CUDA availability and CUDA backend enabled/disabled.
19-
TORCH_NIGHTLY_URL_BASE = "https://download.pytorch.org/whl/nightly"
19+
TORCH_URL_BASE = "https://download.pytorch.org/whl/test"
2020

2121
# Since ExecuTorch often uses main-branch features of pytorch, only the nightly
2222
# pip versions will have the required features.
@@ -44,29 +44,27 @@ def install_requirements(use_pytorch_nightly):
4444
sys.exit(1)
4545

4646
# Determine the appropriate PyTorch URL based on CUDA delegate status
47-
torch_url = determine_torch_url(TORCH_NIGHTLY_URL_BASE)
47+
torch_url = determine_torch_url(TORCH_URL_BASE)
4848

4949
# pip packages needed by exir.
5050
TORCH_PACKAGE = [
5151
# Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
5252
# that we don't need to set any version number there because they have already
5353
# been installed on CI before this step, so pip won't reinstall them
54-
(
55-
f"torch=={TORCH_VERSION}.{NIGHTLY_VERSION}"
56-
if use_pytorch_nightly
57-
else "torch"
58-
),
54+
(f"torch=={TORCH_VERSION}" if use_pytorch_nightly else "torch"),
5955
]
6056

6157
# Install the requirements for core ExecuTorch package.
6258
# `--extra-index-url` tells pip to look for package
6359
# versions on the provided URL if they aren't available on the default URL.
60+
# Use --no-cache-dir to avoid stale cache issues with mutable test wheels.
6461
subprocess.run(
6562
[
6663
sys.executable,
6764
"-m",
6865
"pip",
6966
"install",
67+
"--no-cache-dir",
7068
"-r",
7169
"requirements-dev.txt",
7270
*TORCH_PACKAGE,
@@ -114,20 +112,12 @@ def install_requirements(use_pytorch_nightly):
114112

115113
def install_optional_example_requirements(use_pytorch_nightly):
116114
# Determine the appropriate PyTorch URL based on CUDA delegate status
117-
torch_url = determine_torch_url(TORCH_NIGHTLY_URL_BASE)
115+
torch_url = determine_torch_url(TORCH_URL_BASE)
118116

119117
print("Installing torch domain libraries")
120118
DOMAIN_LIBRARIES = [
121-
(
122-
f"torchvision==0.26.0.{NIGHTLY_VERSION}"
123-
if use_pytorch_nightly
124-
else "torchvision"
125-
),
126-
(
127-
f"torchaudio==2.11.0.{NIGHTLY_VERSION}"
128-
if use_pytorch_nightly
129-
else "torchaudio"
130-
),
119+
("torchvision==0.26.0" if use_pytorch_nightly else "torchvision"),
120+
("torchaudio==2.11.0" if use_pytorch_nightly else "torchaudio"),
131121
]
132122
# Then install domain libraries
133123
subprocess.run(
@@ -136,6 +126,7 @@ def install_optional_example_requirements(use_pytorch_nightly):
136126
"-m",
137127
"pip",
138128
"install",
129+
"--no-cache-dir",
139130
*DOMAIN_LIBRARIES,
140131
"--extra-index-url",
141132
torch_url,

runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ __host__ __device__
629629
// This macro is used to find older C++ compilers
630630
// that don't support move optimization for return values.
631631

632-
#if (defined(__GNUC__) && __GNUC__ < 13 && __cplusplus < 202002L) || \
632+
#if (defined(__GNUC__) && __GNUC__ < 13) || \
633633
(defined(__clang_major__) && __clang_major__ < 13)
634634
#define C10_RETURN_MOVE_IF_OLD_COMPILER 1
635635
#else

torch_pin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
TORCH_VERSION = "2.12.0"
2-
NIGHTLY_VERSION = "dev20260310"
1+
TORCH_VERSION = "2.11.0"
2+
# NIGHTLY_VERSION = "dev20260310" Using release candidate in main. Will need to revert back this PR 18187 to use nightly.

0 commit comments

Comments
 (0)