Skip to content
Closed
Changes from 1 commit
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
40 changes: 29 additions & 11 deletions extension/android/benchmark/android-llm-device-farm-test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ phases:
commands:
# Prepare the model and the tokenizer
- adb -s $DEVICEFARM_DEVICE_UDID shell "ls -la /sdcard/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mkdir -p /data/local/tmp/llama/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mv /sdcard/*.bin /data/local/tmp/llama/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mv /sdcard/*.pte /data/local/tmp/llama/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "chmod 664 /data/local/tmp/llama/*.bin"
- adb -s $DEVICEFARM_DEVICE_UDID shell "chmod 664 /data/local/tmp/llama/*.pte"
- adb -s $DEVICEFARM_DEVICE_UDID shell "ls -la /data/local/tmp/llama/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mkdir -p /data/local/tmp/minibench/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mv /sdcard/*.bin /data/local/tmp/minibench/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "mv /sdcard/*.pte /data/local/tmp/minibench/"
- adb -s $DEVICEFARM_DEVICE_UDID shell "chmod 664 /data/local/tmp/minibench/*.bin"
- adb -s $DEVICEFARM_DEVICE_UDID shell "chmod 664 /data/local/tmp/minibench/*.pte"
- adb -s $DEVICEFARM_DEVICE_UDID shell "ls -la /data/local/tmp/minibench/"

test:
commands:
# By default, the following ADB command is used by Device Farm to run your Instrumentation test.
# Please refer to Android's documentation for more options on running instrumentation tests with adb:
# https://developer.android.com/studio/test/command-line#run-tests-with-adb

# Run the Instrumentation test for sanity check
- echo "Starting the Instrumentation test"
- |
adb -s $DEVICEFARM_DEVICE_UDID shell "am instrument -r -w --no-window-animation \
Expand Down Expand Up @@ -67,15 +69,31 @@ phases:
fi;

# Run the new generic benchmark activity https://developer.android.com/tools/adb#am
- echo "Run LLM benchmark"
- echo "Determine model type"
- |
BIN_FOUND="$(adb -s $DEVICEFARM_DEVICE_UDID shell find /data/local/tmp/minibench/ -name '*.bin')"
if [ -z "$BIN_FOUND" ]; then
echo "No tokenizer files found in /data/local/tmp/minibench/"
else
echo "tokenizer files found in /data/local/tmp/minibench/"
fi

- echo "Run benchmark"
- |
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n org.pytorch.minibench/.LlmBenchmarkActivity \
--es "model_dir" "/data/local/tmp/llama" \
--es "tokenizer_path" "/data/local/tmp/llama/tokenizer.bin"
adb -s $DEVICEFARM_DEVICE_UDID shell am force-stop org.pytorch.minibench
if [ -z "$BIN_FOUND" ]; then
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n org.pytorch.minibench/.BenchmarkActivity \
--es "model_dir" "/data/local/tmp/minibench"
else
adb -s $DEVICEFARM_DEVICE_UDID shell am start -W -n org.pytorch.minibench/.LlmBenchmarkActivity \
--es "model_dir" "/data/local/tmp/minibench" \
--es "tokenizer_path" "/data/local/tmp/minibench/tokenizer.bin"
fi


post_test:
commands:
- echo "Gather LLM benchmark results"
- echo "Gather benchmark results"
- |
BENCHMARK_RESULTS=""
ATTEMPT=0
Expand Down
Loading