diff --git a/.github/workflows/debug-hf-cache-oom.yml b/.github/workflows/debug-hf-cache-oom.yml new file mode 100644 index 00000000000..b9ee503f63a --- /dev/null +++ b/.github/workflows/debug-hf-cache-oom.yml @@ -0,0 +1,76 @@ +# [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 + + hf-load: + needs: docker-image + name: load (${{ matrix.mode }}, ${{ matrix.model }}, ${{ 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, 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: ${{ 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 }} + 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 + # 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 AutoModel + t = time.time() + print("load start", time.strftime("%H:%M:%S", time.gmtime()), flush=True) + 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 + echo "end=$(date -u +%FT%TZ)"