|
7 | 7 |
|
8 | 8 | set -euo pipefail |
9 | 9 |
|
| 10 | +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" |
| 11 | + |
| 12 | +# Download QNN_SDK. If already downloaded, export environment path |
| 13 | +source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh" |
| 14 | +install_qnn |
| 15 | + |
| 16 | +export EXECUTORCH_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" |
| 17 | +export LD_LIBRARY_PATH="${QNN_SDK_ROOT}/lib/x86_64-linux-clang" |
| 18 | +export PYTHONPATH=".." |
| 19 | +cp schema/program.fbs exir/_serialize/program.fbs |
| 20 | +cp schema/scalar_type.fbs exir/_serialize/scalar_type.fbs |
| 21 | +cp -f build-x86/backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python |
| 22 | +cp -f build-x86/backends/qualcomm/PyQnnWrapperAdaptor.cpython-310-x86_64-linux-gnu.so backends/qualcomm/python |
| 23 | + |
| 24 | +if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then |
| 25 | + PYTHON_EXECUTABLE=python3 |
| 26 | +fi |
| 27 | + |
| 28 | +which "${PYTHON_EXECUTABLE}" |
| 29 | + |
10 | 30 | # Config |
11 | 31 | PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE:-python3}" |
12 | 32 | MODEL="qwen2_5-0_5b" |
13 | 33 | MAX_SEQ=1024 |
14 | 34 | PTQ="16a4w" |
15 | 35 | THRESHOLD=62.0 # regression guardrail |
16 | 36 |
|
17 | | -# Run command and capture log |
| 37 | +EXTRA_FLAGS="$@" |
| 38 | + |
| 39 | +# Run command and capture *both stdout and stderr* |
18 | 40 | LOG_FILE="eval_${MODEL}_$(date +%Y%m%d_%H%M%S).log" |
19 | 41 |
|
20 | 42 | echo ">>> Running evaluation..." |
21 | 43 | $PYTHON_EXECUTABLE -m executorch.examples.qualcomm.oss_scripts.llama.eval_llama_qnn \ |
22 | 44 | --decoder_model "$MODEL" \ |
23 | 45 | --quant_linear_only \ |
24 | 46 | --max_seq_length "$MAX_SEQ" \ |
25 | | - --ptq "$PTQ" | tee "$LOG_FILE" |
| 47 | + --ptq "$PTQ" \ |
| 48 | + $EXTRA_FLAGS 2>&1 | tee "$LOG_FILE" |
26 | 49 |
|
27 | 50 | # Extract last word_perplexity |
28 | 51 | LAST_PERP=$(grep "INFO:root:wikitext:" "$LOG_FILE" | tail -n 1 | sed -E "s/.*'word_perplexity,none': ([0-9.]+).*/\1/") |
|
0 commit comments