Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # All rights reserved. | |
| # | |
| # This source code is licensed under the BSD-style license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| name: LlamaDemo Android | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'llm/android/**' | |
| - '.github/workflows/llm-android.yml' | |
| workflow_dispatch: | |
| inputs: | |
| pte_url: | |
| description: 'URL to download model .pte file' | |
| required: false | |
| type: string | |
| default: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/stories110M.pte' | |
| tokenizer_url: | |
| description: 'URL to download tokenizer file' | |
| required: false | |
| type: string | |
| default: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/tokenizer.model' | |
| permissions: | |
| contents: read | |
| env: | |
| # Default URLs for pull_request trigger (workflow_dispatch inputs override these) | |
| DEFAULT_PTE_URL: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/stories110M.pte' | |
| DEFAULT_TOKENIZER_URL: 'https://ossci-android.s3.amazonaws.com/executorch/stories/snapshot-20260114/tokenizer.model' | |
| jobs: | |
| instrumentation-test: | |
| runs-on: linux.24xl.spr-metal | |
| env: | |
| API_LEVEL: 34 | |
| ARCH: x86_64 | |
| EMULATOR_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| name: Instrumentation Test LlamaDemo | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Enable KVM group perms | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Download model files | |
| run: | | |
| PTE_URL="${{ inputs.pte_url || env.DEFAULT_PTE_URL }}" | |
| TOKENIZER_URL="${{ inputs.tokenizer_url || env.DEFAULT_TOKENIZER_URL }}" | |
| mkdir -p /tmp/llama-models | |
| echo "Downloading model from $PTE_URL" | |
| curl -fL -o /tmp/llama-models/model.pte "$PTE_URL" | |
| echo "Downloading tokenizer from $TOKENIZER_URL" | |
| curl -fL -o /tmp/llama-models/tokenizer.model "$TOKENIZER_URL" | |
| ls -la /tmp/llama-models/ | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-${{ env.API_LEVEL }}-${{ env.ARCH }} | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.API_LEVEL }} | |
| arch: ${{ env.ARCH }} | |
| force-avd-creation: false | |
| ram-size: 6144M | |
| emulator-options: ${{ env.EMULATOR_OPTIONS }} | |
| disable-animations: false | |
| working-directory: llm/android/LlamaDemo | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Run instrumentation tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ env.API_LEVEL }} | |
| arch: ${{ env.ARCH }} | |
| force-avd-creation: false | |
| ram-size: 6144M | |
| emulator-options: -no-snapshot-save ${{ env.EMULATOR_OPTIONS }} | |
| disable-animations: true | |
| working-directory: llm/android/LlamaDemo | |
| script: | | |
| adb shell mkdir -p /data/local/tmp/llama/ | |
| adb push /tmp/llama-models/model.pte /data/local/tmp/llama/ | |
| adb push /tmp/llama-models/tokenizer.model /data/local/tmp/llama/ | |
| ./gradlew connectedCheck -PskipModelDownload=true |