Skip to content

Commit 9c084a2

Browse files
committed
fix test and add more tests
1 parent 2280e1b commit 9c084a2

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

.ci/scripts/test_qnn_static_llama_eval.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,45 @@
77

88
set -euo pipefail
99

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+
1030
# Config
1131
PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE:-python3}"
1232
MODEL="qwen2_5-0_5b"
1333
MAX_SEQ=1024
1434
PTQ="16a4w"
1535
THRESHOLD=62.0 # regression guardrail
1636

17-
# Run command and capture log
37+
EXTRA_FLAGS="$@"
38+
39+
# Run command and capture *both stdout and stderr*
1840
LOG_FILE="eval_${MODEL}_$(date +%Y%m%d_%H%M%S).log"
1941

2042
echo ">>> Running evaluation..."
2143
$PYTHON_EXECUTABLE -m executorch.examples.qualcomm.oss_scripts.llama.eval_llama_qnn \
2244
--decoder_model "$MODEL" \
2345
--quant_linear_only \
2446
--max_seq_length "$MAX_SEQ" \
25-
--ptq "$PTQ" | tee "$LOG_FILE"
47+
--ptq "$PTQ" \
48+
$EXTRA_FLAGS 2>&1 | tee "$LOG_FILE"
2649

2750
# Extract last word_perplexity
2851
LAST_PERP=$(grep "INFO:root:wikitext:" "$LOG_FILE" | tail -n 1 | sed -E "s/.*'word_perplexity,none': ([0-9.]+).*/\1/")

.github/workflows/pull.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,12 @@ jobs:
601601
contents: read
602602
strategy:
603603
fail-fast: false
604+
matrix:
605+
config:
606+
- { name: "baseline", flags: "" }
607+
- { name: "spinquant", flags: "--spinquant" }
608+
- { name: "range-setting", flags: "--range_setting mse_with_act_loss" }
609+
- { name: "spinquant+range-setting", flags: "--spinquant --range_setting mse_with_act_loss" }
604610
with:
605611
runner: linux.2xlarge
606612
docker-image: ci-image:executorch-ubuntu-22.04-qnn-sdk
@@ -624,7 +630,8 @@ jobs:
624630
PYTHON_EXECUTABLE=python bash examples/models/llama/install_requirements.sh
625631
626632
# Test static llama weight sharing and accuracy
627-
PYTHON_EXECUTABLE=python bash .ci/scripts/test_qnn_static_llama_eval.sh
633+
echo ">>> Running config: ${{ matrix.config.name }}"
634+
PYTHON_EXECUTABLE=python bash .ci/scripts/test_qnn_static_llama_eval.sh ${{ matrix.config.flags }}
628635
629636
630637
# test-qnn-models-linux:

0 commit comments

Comments
 (0)