Skip to content

Commit f8fda0a

Browse files
authored
Add a test to ensure that PT built from the pinned commit is used (#6785)
* Add a test to ensure that PT built from the pinned commit is used * Fix grep * Also make this work when running on PT CI
1 parent e332e2a commit f8fda0a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.ci/scripts/setup-linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ fi
2323
# of nightly. This allows CI to test against latest commits from PyTorch
2424
install_executorch "use-pt-pinned-commit"
2525
build_executorch_runner "${BUILD_TOOL}"
26+
do_not_use_nightly_on_ci

.ci/scripts/utils.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,26 @@ cmake_install_executorch_lib() {
113113
}
114114

115115
download_stories_model_artifacts() {
116-
# Download stories110M.pt and tokenizer from Github
116+
# Download stories110M.pt and tokenizer from Github
117117
curl -Ls "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt" --output stories110M.pt
118118
curl -Ls "https://raw.githubusercontent.com/karpathy/llama2.c/master/tokenizer.model" --output tokenizer.model
119119
# Create params.json file
120120
touch params.json
121121
echo '{"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000}' > params.json
122122
}
123+
124+
do_not_use_nightly_on_ci() {
125+
# An assert to make sure that we are not using PyTorch nightly on CI to prevent
126+
# regression as documented in https://github.com/pytorch/executorch/pull/6564
127+
TORCH_VERSION=$(pip list | grep -w 'torch ' | awk -F ' ' {'print $2'} | tr -d '\n')
128+
129+
# The version of PyTorch building from source looks like 2.6.0a0+gitc8a648d that
130+
# includes the commit while nightly (2.6.0.dev20241019+cpu) or release (2.6.0)
131+
# won't have that. Note that we couldn't check for the exact commit from the pin
132+
# ci_commit_pins/pytorch.txt here because the value will be different when running
133+
# this on PyTorch CI
134+
if [[ "${TORCH_VERSION}" != *"+git"* ]]; then
135+
echo "Unexpected torch version. Expected binary built from source, got ${TORCH_VERSION}"
136+
exit 1
137+
fi
138+
}

0 commit comments

Comments
 (0)