Skip to content

Commit 1d6662d

Browse files
authored
Remove tokenizer variants for Android build
Now we only have one aar with both tiktoken and sentencepiece Pull Request resolved: #5004
1 parent 2520d50 commit 1d6662d

File tree

4 files changed

+9
-26
lines changed

4 files changed

+9
-26
lines changed

.github/workflows/android-perf.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ jobs:
206206
name: build-llm-demo
207207
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
208208
needs: set-parameters
209-
strategy:
210-
matrix:
211-
tokenizer: [bpe]
212209
with:
213210
runner: linux.2xlarge
214211
docker-image: executorch-ubuntu-22.04-clang12-android
@@ -227,7 +224,7 @@ jobs:
227224
228225
# TODO: This needs to be replaced with a generic loader .apk
229226
# Build LLM Demo for Android
230-
bash build/build_android_llm_demo.sh ${{ matrix.tokenizer }} ${ARTIFACTS_DIR_NAME}
227+
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
231228
232229
# Upload artifacts to S3. The artifacts are needed not only by the device farm but also TorchChat
233230
upload-android-apps:

.github/workflows/android.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
build-llm-demo:
2525
name: build-llm-demo
2626
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
27-
strategy:
28-
matrix:
29-
tokenizer: [bpe, tiktoken]
3027
with:
3128
runner: linux.2xlarge
3229
docker-image: executorch-ubuntu-22.04-clang12-android
@@ -44,7 +41,7 @@ jobs:
4441
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
4542
4643
# Build LLM Demo for Android
47-
bash build/build_android_llm_demo.sh ${{ matrix.tokenizer }} ${ARTIFACTS_DIR_NAME}
44+
bash build/build_android_llm_demo.sh ${ARTIFACTS_DIR_NAME}
4845
4946
# Upload artifacts to S3. The artifacts are needed not only by the device farm but also TorchChat
5047
upload-artifacts:
@@ -155,13 +152,6 @@ jobs:
155152
id-token: write
156153
contents: read
157154
uses: pytorch/test-infra/.github/workflows/mobile_job.yml@main
158-
strategy:
159-
matrix:
160-
# https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/LlamaDemo/README.md#alternative-2-build-from-local-machine
161-
# mentions that tiktoken is only for Llama3. So, we can export it later in another archive
162-
# like https://ossci-assets.s3.amazonaws.com/executorch-android-llama2-7b-0717.zip when this is
163-
# updated to run Llama3
164-
tokenizer: [bpe]
165155
with:
166156
device-type: android
167157
runner: linux.2xlarge
@@ -171,8 +161,8 @@ jobs:
171161
# This is the custom Android device pool that only includes Samsung Galaxy S2x
172162
device-pool-arn: arn:aws:devicefarm:us-west-2:308535385114:devicepool:02a2cf0f-6d9b-45ee-ba1a-a086587469e6/e59f866a-30aa-4aa1-87b7-4510e5820dfa
173163
# Uploaded to S3 from the previous job, the name of the app comes from the project itself
174-
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_${{ matrix.tokenizer }}/app-debug.apk
175-
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo_${{ matrix.tokenizer }}/app-debug-androidTest.apk
164+
android-app-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo/app-debug.apk
165+
android-test-archive: https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifact/llm_demo/app-debug-androidTest.apk
176166
test-spec: https://ossci-android.s3.amazonaws.com/executorch/android-llm-device-farm-test-spec.yml
177167
# Among the input, this is the biggest file, so it is cached on AWS to make the test faster. Note that the file is deleted by AWS after 30
178168
# days and the job will automatically re-upload the file when that happens.

build/build_android_llm_demo.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ build_jar() {
1717

1818
build_android_native_library() {
1919
ANDROID_ABI="$1"
20-
TOKENIZER="$2"
2120
ANDROID_NDK="${ANDROID_NDK:-/opt/ndk}"
2221
CMAKE_OUT="cmake-out-android-${ANDROID_ABI}"
2322

@@ -100,9 +99,8 @@ build_android_llm_demo_app() {
10099
}
101100

102101
collect_artifacts_to_be_uploaded() {
103-
TOKENIZER="$1"
104-
ARTIFACTS_DIR_NAME="$2"
105-
DEMO_APP_DIR="${ARTIFACTS_DIR_NAME}/llm_demo_${TOKENIZER}"
102+
ARTIFACTS_DIR_NAME="$1"
103+
DEMO_APP_DIR="${ARTIFACTS_DIR_NAME}/llm_demo"
106104
# The app directory is named using its build flavor as a suffix.
107105
mkdir -p "${DEMO_APP_DIR}"
108106
# Collect the app and its test suite
@@ -124,13 +122,12 @@ export BUILD_AAR_DIR
124122
ANDROID_ABIS=("arm64-v8a" "x86_64")
125123
export ANDROID_ABIS
126124

127-
TOKENIZER="${1:-bpe}"
128-
ARTIFACTS_DIR_NAME="$2"
125+
ARTIFACTS_DIR_NAME="$1"
129126

130127
build_jar
131128
for ANDROID_ABI in "${ANDROID_ABIS[@]}"; do
132-
build_android_native_library ${ANDROID_ABI} ${TOKENIZER}
129+
build_android_native_library ${ANDROID_ABI}
133130
done
134131
build_aar
135132
build_android_llm_demo_app
136-
collect_artifacts_to_be_uploaded ${TOKENIZER} ${ARTIFACTS_DIR_NAME}
133+
collect_artifacts_to_be_uploaded ${ARTIFACTS_DIR_NAME}

examples/demo-apps/android/LlamaDemo/setup.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
set -eu
99

1010
CMAKE_OUT="${CMAKE_OUT:-cmake-out-android}"
11-
EXECUTORCH_USE_TIKTOKEN="${EXECUTORCH_USE_TIKTOKEN:-OFF}"
1211
# Note: Set up ANDROID_NDK and ANDROID_ABI
1312
cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
1413
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \

0 commit comments

Comments
 (0)