Skip to content

Update model files to use Qwen3-4B-INT8-INT4 from HuggingFace #41

Update model files to use Qwen3-4B-INT8-INT4 from HuggingFace

Update model files to use Qwen3-4B-INT8-INT4 from HuggingFace #41

Workflow file for this run

# 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: Android Build
on:
push:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: LlamaDemo
path: llm/android/LlamaDemo
- name: DeepLabV3Demo
path: dl3/android/DeepLabV3Demo
name: Build ${{ matrix.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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: Build with Gradle
working-directory: ${{ matrix.path }}
run: ./gradlew build --no-daemon
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-apk
path: ${{ matrix.path }}/app/build/outputs/apk/
if-no-files-found: warn
instrumentation-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: LlamaDemo
path: llm/android/LlamaDemo
env:
API_LEVEL: 34
ARCH: x86_64
EMULATOR_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
name: Instrumentation Test ${{ matrix.name }}
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: 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
emulator-options: ${{ env.EMULATOR_OPTIONS }}
disable-animations: false
working-directory: ${{ matrix.path }}
script: echo "Generated AVD snapshot for caching."
- name: Download model files
run: |
set -e
mkdir -p model_files
curl -fL -o model_files/model.pte "https://huggingface.co/pytorch/Qwen3-4B-INT8-INT4/resolve/main/model.pte"
curl -fL -o model_files/tokenizer.bin "https://huggingface.co/pytorch/Qwen3-4B-INT8-INT4/resolve/main/tokenizer.json"
- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API_LEVEL }}
arch: ${{ env.ARCH }}
force-avd-creation: false
emulator-options: -no-snapshot-save ${{ env.EMULATOR_OPTIONS }}
disable-animations: true
working-directory: ${{ matrix.path }}
script: |
set -e
adb shell mkdir -p /data/local/tmp/llama
adb push $GITHUB_WORKSPACE/model_files/model.pte /data/local/tmp/llama/
adb push $GITHUB_WORKSPACE/model_files/tokenizer.bin /data/local/tmp/llama/
./gradlew connectedCheck