Skip to content

Upload exported models and Android apps directly to S3 #5375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 7 additions & 62 deletions .github/workflows/android-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ jobs:
submodules: 'true'
timeout: 60
upload-artifact: android-models
upload-artifact-to-s3: true
script: |
# The generic Linux job chooses to use base env, not the one setup by the image
echo "::group::Setting up dev environment"
Expand Down Expand Up @@ -175,35 +176,6 @@ jobs:
fi
echo "::endgroup::"

# Upload models to S3. The artifacts are needed not only by the device farm but also TorchChat
upload-models:
needs: export-models
runs-on: linux.2xlarge
if: always() # Continue this job regardless of previous job outcome
steps:
- name: Download the models from GitHub
uses: actions/download-artifact@v3
with:
# The name here needs to match the name of the upload-artifact parameter
name: android-models
path: ${{ runner.temp }}/artifacts/

- name: Verify the models
shell: bash
working-directory: ${{ runner.temp }}/artifacts/
run: |
ls -lah ./

- name: Upload the models to S3
uses: seemethere/upload-artifact-s3@v5
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
retention-days: 1
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/

build-llm-demo:
name: build-llm-demo
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
Expand All @@ -215,6 +187,7 @@ jobs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
upload-artifact: android-apps
upload-artifact-to-s3: true
script: |
set -eux

Expand All @@ -230,34 +203,6 @@ jobs:
export ANDROID_ABIS="arm64-v8a"
PYTHON_EXECUTABLE=python EXECUTORCH_BUILD_QNN=ON QNN_SDK_ROOT=/tmp/qnn/2.25.0.240728 bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}

# Upload artifacts to S3. The artifacts are needed not only by the device farm but also TorchChat
upload-android-apps:
needs: build-llm-demo
runs-on: linux.2xlarge
steps:
- name: Download the apps from GitHub
uses: actions/download-artifact@v3
with:
# The name here needs to match the name of the upload-artifact parameter
name: android-apps
path: ${{ runner.temp }}/artifacts/

- name: Verify the apps
shell: bash
working-directory: ${{ runner.temp }}/artifacts/
run: |
ls -lah ./

- name: Upload the apps to S3
uses: seemethere/upload-artifact-s3@v5
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
retention-days: 14
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/

# Let's see how expensive this job is, we might want to tone it down by running it periodically
benchmark-on-device:
permissions:
Expand All @@ -266,8 +211,8 @@ jobs:
uses: pytorch/test-infra/.github/workflows/mobile_job.yml@main
needs:
- set-parameters
- upload-models
- upload-android-apps
- build-llm-demo
- export-models
strategy:
matrix:
model: ${{ fromJson(needs.set-parameters.outputs.models) }}
Expand All @@ -285,9 +230,9 @@ jobs:
# Unlike models there are limited numbers of build flavor for apps, and the model controls whether it should build with bpe/tiktoken tokenizer.
# It's okay to build all possible apps with all possible flavors in job "build-llm-demo". However, in this job, once a model is given, there is only
# one app+flavor that could load and run the model.
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/minibench/app-debug.apk
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/minibench/app-debug-androidTest.apk
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/minibench/app-debug.apk
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/minibench/app-debug-androidTest.apk
# NB: Need to set the default spec here so that it works for periodic too
test-spec: ${{ inputs.test_spec || 'https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml' }}
# Uploaded to S3 from the previous job
extra-data: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/${{ matrix.model }}_${{ matrix.delegate }}/model.zip
extra-data: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/model.zip
33 changes: 1 addition & 32 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
upload-artifact: android-apps
upload-artifact-to-s3: true
script: |
set -eux

Expand All @@ -45,38 +46,6 @@ jobs:
# Build LLM Demo for Android
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}

# Upload artifacts to S3. The artifacts are needed not only by the device farm but also TorchChat
upload-artifacts:
needs: build-llm-demo
runs-on: linux.2xlarge
steps:
- name: Download the artifacts from GitHub
uses: actions/download-artifact@v3
with:
# The name here needs to match the name of the upload-artifact parameter
name: android-apps
path: ${{ runner.temp }}/artifacts/

- name: Verify the artifacts
shell: bash
working-directory: ${{ runner.temp }}/artifacts/
run: |
ls -lah ./

- name: Upload the artifacts to S3
uses: seemethere/upload-artifact-s3@v5
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
# NOTE: Consume stale artifacts won't make sense for benchmarking as the goal is always to
# benchmark models as fresh as possible. I'm okay to keep the 14 retention-days for now
# for TorchChat until we have a periodic job can publish it more often. Ideally I want to
# reduce it to <= 2 day, meaning the benchmark job will run daily.
retention-days: 14
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/

# Running Android emulator directly on the runner and not using Docker
run-emulator:
needs: build-llm-demo
Expand Down
42 changes: 8 additions & 34 deletions .github/workflows/apple-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ jobs:
delegate: ${{ fromJson(needs.set-parameters.outputs.delegates) }}
fail-fast: false
with:
runner: macos-latest-xlarge
# NB: Need to use our AWS MacOS runner to upload large models to S3
runner: macos-m1-stable
python-version: '3.11'
submodules: 'true'
timeout: 60
upload-artifact: ios-models
upload-artifact-to-s3: true
script: |
set -eux

Expand Down Expand Up @@ -176,34 +178,6 @@ jobs:
fi
echo "::endgroup::"

upload-models:
needs: export-models
runs-on: linux.2xlarge
if: always() # Continue this job regardless of previous job outcome
steps:
- name: Download the models from GitHub
uses: actions/download-artifact@v3
with:
# The name here needs to match the name of the upload-artifact parameter
name: ios-models
path: ${{ runner.temp }}/artifacts/

- name: Verify the models
shell: bash
working-directory: ${{ runner.temp }}/artifacts/
run: |
ls -lah ./

- name: Upload the models to S3
uses: seemethere/upload-artifact-s3@v5
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
retention-days: 1
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/

build-benchmark-app:
name: build-benchmark-app
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
Expand Down Expand Up @@ -297,7 +271,7 @@ jobs:
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
${{ github.repository }}/${{ github.run_id }}/artifacts
retention-days: 14
if-no-files-found: ignore
path: ${{ runner.temp }}/artifacts/
Expand All @@ -306,7 +280,7 @@ jobs:
needs:
- set-parameters
- upload-benchmark-app
- upload-models
- export-models
permissions:
id-token: write
contents: read
Expand All @@ -326,7 +300,7 @@ jobs:
project-arn: arn:aws:devicefarm:us-west-2:308535385114:project:02a2cf0f-6d9b-45ee-ba1a-a086587469e6
device-pool-arn: ${{ matrix.device }}
# Uploaded to S3 from the previous job
ios-ipa-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/Benchmark.ipa
ios-xctestrun-zip: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/Benchmark.xctestrun.zip
ios-ipa-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.ipa
ios-xctestrun-zip: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/Benchmark.xctestrun.zip
test-spec: ${{ inputs.test_spec || 'https://ossci-ios.s3.amazonaws.com/executorch/default-ios-device-farm-appium-test-spec.yml' }}
extra-data: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/${{ matrix.model }}_${{ matrix.delegate }}/model.zip
extra-data: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.delegate }}/model.zip
4 changes: 2 additions & 2 deletions .github/workflows/upload-android-test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
${{ github.repository }}/${{ github.run_id }}/artifacts
retention-days: 1
if-no-files-found: error
path: extension/android/benchmark/android-llm-device-farm-test-spec.yml
Expand All @@ -45,7 +45,7 @@ jobs:
models: stories110M
devices: samsung_galaxy_s22
delegates: xnnpack
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/android-llm-device-farm-test-spec.yml
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/android-llm-device-farm-test-spec.yml

upload-android-test-spec:
needs: validate-android-test-spec
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upload-apple-test-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
s3-bucket: gha-artifacts
s3-prefix: |
${{ github.repository }}/${{ github.run_id }}/artifact
${{ github.repository }}/${{ github.run_id }}/artifacts
retention-days: 1
if-no-files-found: error
path: examples/demo-apps/apple_ios/default-ios-device-farm-appium-test-spec.yml
Expand All @@ -46,7 +46,7 @@ jobs:
models: stories110M
devices: apple_iphone_15
delegates: xnnpack
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/default-ios-device-farm-appium-test-spec.yml
test_spec: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/default-ios-device-farm-appium-test-spec.yml

upload-apple-test-spec:
needs: validate-apple-test-spec
Expand Down
Loading