Skip to content
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
21 changes: 0 additions & 21 deletions .ci/scripts/build_android_instrumentation.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
export BUILD_AAR_DIR=aar-out
mkdir -p $BUILD_AAR_DIR
bash scripts/build_android_library.sh
bash examples/models/llama/install_requirements.sh
(cd ${BUILD_AAR_DIR}; ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:testDebugUnitTest :executorch_android:assembleAndroidTest)
cp ${BUILD_AAR_DIR}/executorch.aar $ARTIFACTS_DIR_NAME

mkdir -p ${ARTIFACTS_DIR_NAME}/library_test_dir
bash .ci/scripts/build_android_instrumentation.sh
cp ${BUILD_AAR_DIR}/executorch_android/build/outputs/apk/androidTest/debug/executorch_android-debug-androidTest.apk "${ARTIFACTS_DIR_NAME}/library_test_dir"

mkdir -p ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
bash examples/models/llama/install_requirements.sh
bash ".ci/scripts/test_llama.sh" -model stories110M -build_tool cmake -dtype fp16 -mode portable -upload ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom

mkdir -p examples/demo-apps/android/LlamaDemo/app/libs
Expand Down
12 changes: 12 additions & 0 deletions extension/android/executorch_android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ android {
}
}

tasks.register("copyTestPte") {
doLast {
exec {
commandLine "sh", "get_instrumentation_test_pte.sh"
}
}
}

afterEvaluate {
tasks.getByName("compileDebugAndroidTestJavaWithJavac").dependsOn "copyTestPte"
}

dependencies {
implementation 'com.facebook.fbjni:fbjni:0.5.1'
implementation 'com.facebook.soloader:nativeloader:0.10.5'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# 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.

SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")

mkdir -p "${SCRIPT_DIR}/src/androidTest/resources"
cp "${SCRIPT_DIR}/../../../extension/module/test/resources/add.pte" "${SCRIPT_DIR}/src/androidTest/resources"

pushd "${SCRIPT_DIR}/../../../"
curl -Ls "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt" --output stories110M.pt
curl -Ls "https://raw.githubusercontent.com/karpathy/llama2.c/master/tokenizer.model" --output tokenizer.model
touch params.json
echo '{"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000}' > params.json
python -m examples.models.llama.export_llama -X --xnnpack-extended-ops -qmode 8da4w -G 128 -c stories110M.pt -p params.json --output_name tinyllama_portable_fp16_h.pte
mv tinyllama_portable_fp16_h.pte "${SCRIPT_DIR}/src/androidTest/resources"
rm stories110M.pt tokenizer.model params.json
popd
Loading