Skip to content

Commit 5a8fd33

Browse files
authored
Merge branch 'main' into baris_mletorch-2055_dynamic-pad-guard
2 parents c65f9fe + d87890d commit 5a8fd33

674 files changed

Lines changed: 38028 additions & 5701 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/docker/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ case "${IMAGE_NAME}" in
8484
CUDA_VERSION=12.8
8585
SKIP_PYTORCH=yes
8686
;;
87+
executorch-ubuntu-24.04-gcc14)
88+
LINTRUNNER=""
89+
OS_VERSION=24.04
90+
GCC_VERSION=14
91+
;;
8792
*)
8893
echo "Invalid image name ${IMAGE_NAME}"
8994
exit 1
@@ -92,6 +97,10 @@ esac
9297
TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt)
9398
BUILD_DOCS=1
9499

100+
if [[ "${GCC_VERSION:-}" == "11" && -z "${SKIP_PYTORCH:-}" ]]; then
101+
PYTORCH_BUILD_MAX_JOBS=6
102+
fi
103+
95104
# Copy requirements-lintrunner.txt from root to here
96105
cp ../../requirements-lintrunner.txt ./
97106

@@ -104,6 +113,7 @@ docker build \
104113
--build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \
105114
--build-arg "MINICONDA_VERSION=${MINICONDA_VERSION}" \
106115
--build-arg "TORCH_VERSION=${TORCH_VERSION}" \
116+
--build-arg "PYTORCH_BUILD_MAX_JOBS=${PYTORCH_BUILD_MAX_JOBS:-}" \
107117
--build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \
108118
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
109119
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
release/2.11
1+
release/2.12

.ci/docker/common/install_android.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ install_ndk() {
4343
ARCH=$(uname -m)
4444
if [ "${ARCH}" = "aarch64" ]; then
4545
# aarch64 NDK is not cached on S3, download from Google directly
46-
curl -Os --retry 3 "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
46+
curl -Os --retry 3 --retry-all-errors "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
4747
else
4848
# The NDK installation is cached on ossci-android S3 bucket
49-
curl -Os --retry 3 "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
49+
curl -Os --retry 3 --retry-all-errors "https://ossci-android.s3.amazonaws.com/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
5050
fi
5151
unzip -qo "android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
5252

@@ -62,7 +62,7 @@ install_cmdtools() {
6262

6363
pushd /tmp
6464
# The file is cached on ossci-android S3 bucket
65-
curl -Os --retry 3 "https://ossci-android.s3.us-west-1.amazonaws.com/${CMDTOOLS_FILENAME}"
65+
curl -Os --retry 3 --retry-all-errors "https://ossci-android.s3.us-west-1.amazonaws.com/${CMDTOOLS_FILENAME}"
6666
unzip -qo "${CMDTOOLS_FILENAME}" -d /opt
6767

6868
ls -lah /opt/cmdline-tools/bin

.ci/docker/common/install_cache.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ install_ubuntu() {
3434

3535
install_binary() {
3636
echo "Downloading sccache binary from S3 repo"
37-
curl --retry 3 https://s3.amazonaws.com/ossci-linux/sccache -o /opt/cache/bin/sccache
37+
curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-linux/sccache -o /opt/cache/bin/sccache
3838
chmod +x /opt/cache/bin/sccache
3939
}
4040

@@ -76,6 +76,9 @@ init_sccache() {
7676
# This is the remote cache bucket
7777
export SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2
7878
export SCCACHE_S3_KEY_PREFIX=executorch
79+
export SCCACHE_REGION=us-east-1
80+
export AWS_REGION=us-east-1
81+
export AWS_DEFAULT_REGION=us-east-1
7982
export SCCACHE_IDLE_TIMEOUT=0
8083
export SCCACHE_ERROR_LOG=/tmp/sccache_error.log
8184
export RUST_LOG=sccache::server=error

.ci/docker/common/install_docs_reqs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ if [ -n "$BUILD_DOCS" ]; then
1212
# Ignore error if gpg-agent doesn't exist (for Ubuntu 16.04)
1313
apt-get install -y gpg-agent || :
1414

15-
curl --retry 3 -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
15+
curl --retry 3 --retry-all-errors -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
1616
sudo apt-get install -y nodejs
1717

18-
curl --retry 3 -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
18+
curl --retry 3 --retry-all-errors -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
1919
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
2020

2121
apt-get update

.ci/docker/common/install_linter.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1515
pip_install -r requirements-lintrunner.txt
1616

1717
# Install google-java-format
18-
curl -L --retry 3 https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format_linux-x86-64 > /opt/google-java-format
18+
curl -L --retry 3 --retry-all-errors https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format_linux-x86-64 > /opt/google-java-format
1919
chmod +x /opt/google-java-format

.ci/docker/common/install_pytorch.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@ install_pytorch_and_domains() {
2727
chown -R ci-user .
2828

2929
export _GLIBCXX_USE_CXX11_ABI=1
30+
if [[ "$(uname -m)" == "aarch64" ]]; then
31+
export BUILD_IGNORE_SVE_UNAVAILABLE=1
32+
fi
33+
if [[ -n "${PYTORCH_BUILD_MAX_JOBS:-}" ]]; then
34+
export MAX_JOBS="${PYTORCH_BUILD_MAX_JOBS}"
35+
fi
3036
# Then build and install PyTorch
3137
conda_run python setup.py bdist_wheel
3238
pip_install "$(echo dist/*.whl)"
3339

3440
# Grab the pinned audio and vision commits from PyTorch
3541
TORCHAUDIO_VERSION=release/2.11
3642
export TORCHAUDIO_VERSION
37-
TORCHVISION_VERSION=release/0.26
43+
TORCHVISION_VERSION=release/0.27
3844
export TORCHVISION_VERSION
3945

4046
install_domains

.ci/docker/common/install_user.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
set -ex
99

10+
# On Ubuntu 24.04, there is a `ubuntu` user with id=1000
11+
if id ubuntu >/dev/null && [[ "$(id -u ubuntu)" == 1000 ]]; then
12+
sudo userdel --remove ubuntu;
13+
fi
14+
1015
# Same as ec2-user
1116
echo "ci-user:x:1000:1000::/var/lib/ci-user:" >> /etc/passwd
1217
echo "ci-user:x:1000:" >> /etc/group

.ci/docker/ubuntu/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ RUN bash ./install_cache.sh && rm install_cache.sh utils.sh
6262
ENV SCCACHE_BUCKET ossci-compiler-cache-circleci-v2
6363
ENV SCCACHE_S3_KEY_PREFIX executorch
6464
ENV SCCACHE_REGION us-east-1
65+
ENV AWS_REGION us-east-1
66+
ENV AWS_DEFAULT_REGION us-east-1
6567

6668
ARG TORCH_VERSION
6769
ARG SKIP_PYTORCH
70+
ARG PYTORCH_BUILD_MAX_JOBS
6871
COPY ./common/install_pytorch.sh install_pytorch.sh
6972
COPY ./common/utils.sh utils.sh
7073
RUN if [ -z "${SKIP_PYTORCH}" ]; then bash ./install_pytorch.sh; fi && rm install_pytorch.sh utils.sh

.ci/scripts/export_model_artifact.sh

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,17 @@ case "$HF_MODEL" in
195195
PREPROCESSOR_FEATURE_SIZE=""
196196
PREPROCESSOR_OUTPUT=""
197197
;;
198+
SocialLocalMobile/gemma-4-31B-it-HQQ-INT4)
199+
MODEL_NAME="gemma4_31b"
200+
TASK=""
201+
MAX_SEQ_LEN=""
202+
EXTRA_PIP=""
203+
PREPROCESSOR_FEATURE_SIZE=""
204+
PREPROCESSOR_OUTPUT=""
205+
;;
198206
*)
199207
echo "Error: Unsupported model '$HF_MODEL'"
200-
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4"
208+
echo "Supported models: mistralai/Voxtral-Mini-3B-2507, mistralai/Voxtral-Mini-4B-Realtime-2602, openai/whisper-{small, medium, large, large-v2, large-v3, large-v3-turbo}, google/gemma-3-4b-it, Qwen/Qwen3-0.6B, nvidia/diar_streaming_sortformer_4spk-v2, nvidia/parakeet-tdt, facebook/dinov2-small-imagenet1k-1-layer, SocialLocalMobile/Qwen3.5-35B-A3B-HQQ-INT4, SocialLocalMobile/gemma-4-31B-it-HQQ-INT4"
201209
exit 1
202210
;;
203211
esac
@@ -459,6 +467,50 @@ if [ "$MODEL_NAME" = "qwen3_5_moe" ]; then
459467
exit 0
460468
fi
461469

470+
# Gemma 4 31B uses a prequantized checkpoint and custom export script
471+
if [ "$MODEL_NAME" = "gemma4_31b" ]; then
472+
pip install safetensors huggingface_hub gguf
473+
474+
# Download prequantized model outside OUTPUT_DIR to avoid uploading on failure
475+
LOCAL_MODEL_DIR=$(mktemp -d)
476+
INDUCTOR_CACHE=$(mktemp -d)
477+
trap 'rm -rf "$LOCAL_MODEL_DIR" "$INDUCTOR_CACHE"' EXIT
478+
479+
python -c "from huggingface_hub import snapshot_download; snapshot_download('${HF_MODEL}', local_dir='${LOCAL_MODEL_DIR}')"
480+
481+
# Sanity check: run inference on the prequantized model
482+
echo "::group::Inference sanity check"
483+
INFERENCE_OUTPUT=$(python -m executorch.examples.models.gemma4_31b.inference \
484+
--prequantized "$LOCAL_MODEL_DIR" \
485+
--prompt "What is the capital of France?" \
486+
--max-new-tokens 32 \
487+
--temperature 0 \
488+
--no-compile 2>&1)
489+
echo "$INFERENCE_OUTPUT"
490+
if ! echo "$INFERENCE_OUTPUT" | grep -q "Paris"; then
491+
echo "ERROR: Inference sanity check failed — expected 'Paris' in output"
492+
exit 1
493+
fi
494+
echo "::endgroup::"
495+
496+
# Copy tokenizer for the runner
497+
cp "$LOCAL_MODEL_DIR/tokenizer.json" "${OUTPUT_DIR}/tokenizer.json"
498+
499+
# Export to .pte/.ptd (short cache dir avoids objcopy symbol length issues)
500+
echo "::group::Export"
501+
TORCHINDUCTOR_CACHE_DIR="$INDUCTOR_CACHE" \
502+
python -m executorch.examples.models.gemma4_31b.export \
503+
--prequantized "$LOCAL_MODEL_DIR" \
504+
--output-dir "${OUTPUT_DIR}"
505+
echo "::endgroup::"
506+
507+
test -f "${OUTPUT_DIR}/model.pte"
508+
test -f "${OUTPUT_DIR}/aoti_cuda_blob.ptd"
509+
ls -al "${OUTPUT_DIR}"
510+
511+
exit 0
512+
fi
513+
462514
MAX_SEQ_LEN_ARG=""
463515
if [ -n "$MAX_SEQ_LEN" ]; then
464516
MAX_SEQ_LEN_ARG="--max_seq_len $MAX_SEQ_LEN"

0 commit comments

Comments
 (0)