From 918952057d2bcd01d2af1b2fce6cdb80c39b4c38 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Tue, 1 Dec 2026 13:52:03 -0700 Subject: [PATCH 1/2] [DO NOT MERGE] Reproduce the hf-cache rclone OOM from test-phi-3-mini --- .github/workflows/debug-hf-cache-oom.yml | 68 ++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/debug-hf-cache-oom.yml diff --git a/.github/workflows/debug-hf-cache-oom.yml b/.github/workflows/debug-hf-cache-oom.yml new file mode 100644 index 00000000000..7ef958c67a0 --- /dev/null +++ b/.github/workflows/debug-hf-cache-oom.yml @@ -0,0 +1,68 @@ +# [DO NOT MERGE] Reproduce the hf-cache rclone OOM seen with test-phi-3-mini-runner-linux. +name: debug-hf-cache-oom + +on: + pull_request: + paths: + - .github/workflows/debug-hf-cache-oom.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + + phi-3-mini: + needs: docker-image + name: phi-3-mini (${{ matrix.mode }}, ${{ matrix.copy }}) + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read + strategy: + fail-fast: false + matrix: + include: + # load: only load the weights from /mnt/hf_cache, the step that dies + - { mode: load, copy: 1 } + - { mode: load, copy: 2 } + - { mode: load, copy: 3 } + - { mode: load, copy: 4 } + - { mode: load, copy: 5 } + - { mode: load, copy: 6 } + # full: the real job, unchanged + - { mode: full, copy: 1 } + - { mode: full, copy: 2 } + with: + runner: mt-l-x86iavx512-32-256 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-clang12-${{ needs.docker-image.outputs.ci-docker-hash }} + submodules: ${{ matrix.mode == 'full' && 'recursive' || '' }} + ref: ${{ github.event.pull_request.head.sha }} + timeout: 90 + script: | + CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") + conda activate "${CONDA_ENV}" + echo "pod=$(cat /etc/hostname) start=$(date -u +%FT%TZ)" + echo "HF_HUB_CACHE=${HF_HUB_CACHE:-} HF_HOME=${HF_HOME:-}" + + if [[ "${{ matrix.mode }}" == "full" ]]; then + PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "cmake" + bash examples/models/phi-3-mini/install_requirements.sh + PYTHON_EXECUTABLE=python bash .ci/scripts/test_phi_3_mini.sh Release + else + python -c "import torch" 2>/dev/null || pip install torch --index-url https://download.pytorch.org/whl/cpu + # Same loader versions as the failing job (optimum-executorch pins transformers 5.0.0rc1). + pip install "transformers==5.0.0rc1" "safetensors==0.8.0" accelerate + python - <<'EOF' + import time, torch + from transformers import AutoModelForCausalLM + t = time.time() + print("load start", time.strftime("%H:%M:%S", time.gmtime()), flush=True) + m = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-4k-instruct", dtype=torch.float32) + print(f"loaded in {time.time() - t:.0f}s", sum(p.numel() for p in m.parameters()), flush=True) + EOF + fi + echo "end=$(date -u +%FT%TZ)" From 6811af602c45c162ef0c13e6919fabd1ac197ce3 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Tue, 1 Dec 2026 13:55:39 -0700 Subject: [PATCH 2/2] Also load gemma-3-4b and the small QNN models --- .github/workflows/debug-hf-cache-oom.yml | 36 +++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/debug-hf-cache-oom.yml b/.github/workflows/debug-hf-cache-oom.yml index 7ef958c67a0..b9ee503f63a 100644 --- a/.github/workflows/debug-hf-cache-oom.yml +++ b/.github/workflows/debug-hf-cache-oom.yml @@ -15,9 +15,9 @@ jobs: name: Resolve CI docker image uses: ./.github/workflows/_docker-image.yml - phi-3-mini: + hf-load: needs: docker-image - name: phi-3-mini (${{ matrix.mode }}, ${{ matrix.copy }}) + name: load (${{ matrix.mode }}, ${{ matrix.model }}, ${{ matrix.copy }}) uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main permissions: id-token: write @@ -27,17 +27,23 @@ jobs: matrix: include: # load: only load the weights from /mnt/hf_cache, the step that dies - - { mode: load, copy: 1 } - - { mode: load, copy: 2 } - - { mode: load, copy: 3 } - - { mode: load, copy: 4 } - - { mode: load, copy: 5 } - - { mode: load, copy: 6 } - # full: the real job, unchanged - - { mode: full, copy: 1 } - - { mode: full, copy: 2 } + - { mode: load, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 1 } + - { mode: load, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 2 } + - { mode: load, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 3 } + - { mode: load, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 4 } + - { mode: load, model: google/gemma-3-4b-it, runner: mt-l-x86iavx512-94-768, copy: 1 } + - { mode: load, model: google/gemma-3-4b-it, runner: mt-l-x86iavx512-94-768, copy: 2 } + - { mode: load, model: google/gemma-3-4b-it, runner: mt-l-x86iavx512-94-768, copy: 3 } + # small models, as test-qnn-optimum-model loads them + - { mode: load, model: google-bert/bert-base-uncased, runner: mt-l-x86iavx512-8-64, copy: 1 } + - { mode: load, model: xlm-roberta-base, runner: mt-l-x86iavx512-8-64, copy: 1 } + - { mode: load, model: distilbert/distilbert-base-uncased, runner: mt-l-x86iavx512-8-64, copy: 1 } + - { mode: load, model: albert/albert-base-v2, runner: mt-l-x86iavx512-8-64, copy: 1 } + # full: the real phi-3-mini job, unchanged + - { mode: full, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 1 } + - { mode: full, model: microsoft/Phi-3-mini-4k-instruct, runner: mt-l-x86iavx512-32-256, copy: 2 } with: - runner: mt-l-x86iavx512-32-256 + runner: ${{ matrix.runner }} docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-clang12-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: ${{ matrix.mode == 'full' && 'recursive' || '' }} ref: ${{ github.event.pull_request.head.sha }} @@ -56,12 +62,14 @@ jobs: python -c "import torch" 2>/dev/null || pip install torch --index-url https://download.pytorch.org/whl/cpu # Same loader versions as the failing job (optimum-executorch pins transformers 5.0.0rc1). pip install "transformers==5.0.0rc1" "safetensors==0.8.0" accelerate + # From the mount only, as the gated models (gemma) cannot be fetched anyway. + export HF_HUB_OFFLINE=1 python - <<'EOF' import time, torch - from transformers import AutoModelForCausalLM + from transformers import AutoModel t = time.time() print("load start", time.strftime("%H:%M:%S", time.gmtime()), flush=True) - m = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-4k-instruct", dtype=torch.float32) + m = AutoModel.from_pretrained("${{ matrix.model }}", dtype=torch.float32) print(f"loaded in {time.time() - t:.0f}s", sum(p.numel() for p in m.parameters()), flush=True) EOF fi