Skip to content

Commit fab9d16

Browse files
committed
Add CI integration for Spark-X2.5 models
This commit adds CI test support for Spark-X2.5-1.7B and Spark-X2.5-4B models to the ExecuTorch test infrastructure. Changes: - Added spark_x2_5_1_7b and spark_x2_5_4b to test_torchao_huggingface_checkpoints.sh - Added both models to CI test matrix in trunk.yml - Configured XNNPACK (x86_64) and TorchAO (ARM64) backend testing - Use --local-dir for hf download to avoid read-only /mnt/hf_cache issues The Spark-X2.5 model infrastructure already exists in the codebase. This commit completes the integration by adding automated CI testing. Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
1 parent fa3e88f commit fab9d16

2 files changed

Lines changed: 64 additions & 4 deletions

File tree

‎.ci/scripts/test_torchao_huggingface_checkpoints.sh‎

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MODEL_NAME=""
1111
# Parse args
1212
if [[ $# -lt 1 ]]; then
1313
echo "Usage: $0 <model_name> [--test_with_runner]"
14-
echo "Supported model_name values: qwen3_4b, phi_4_mini, lfm2_5_1_2b"
14+
echo "Supported model_name values: qwen3_4b, phi_4_mini, lfm2_5_1_2b, spark_x2_5_1_7b, spark_x2_5_4b"
1515
exit 1
1616
fi
1717

@@ -28,7 +28,7 @@ while [[ $# -gt 0 ]]; do
2828
;;
2929
-h|--help)
3030
echo "Usage: $0 <model_name> [--test_with_runner] [--use_torchao_kernels]"
31-
echo " model_name: qwen3_4b | phi_4_mini | lfm2_5_1_2b"
31+
echo " model_name: qwen3_4b | phi_4_mini | lfm2_5_1_2b | spark_x2_5_1_7b | spark_x2_5_4b"
3232
echo " --test_with_runner: build ET + run llama_main to sanity-check the export"
3333
echo " --use_torchao_kernels: use torchao kernels for linear and tied embedding"
3434
exit 0
@@ -125,9 +125,61 @@ case "$MODEL_NAME" in
125125
${BACKEND_ARGS}
126126
;;
127127

128+
spark_x2_5_1_7b)
129+
echo "Running Spark-X2.5-1.7B export..."
130+
HF_MODEL_DIR="${RUNNER_TEMP:-/tmp}/hf_cache/spark_x2_5_1_7b"
131+
mkdir -p "${HF_MODEL_DIR}"
132+
hf download --local-dir "${HF_MODEL_DIR}" XHToken/Spark-X2.5-1.7B
133+
EXPECTED_MODEL_SIZE_UPPER_BOUND=$((2 * 1024 * 1024 * 1024)) # 2GB
134+
$PYTHON_EXECUTABLE -m executorch.examples.models.spark_x2_5.convert_weights \
135+
$HF_MODEL_DIR \
136+
pytorch_model_converted.bin
137+
138+
$PYTHON_EXECUTABLE -m executorch.examples.models.llama.export_llama \
139+
--model "spark_x2_5_1_7b" \
140+
--checkpoint pytorch_model_converted.bin \
141+
--params examples/models/spark_x2_5/config/spark_x2_5_1_7b_config.json \
142+
--output_name $MODEL_OUT \
143+
-kv \
144+
--use_sdpa_with_kv_cache \
145+
--max_context_length 1024 \
146+
--max_seq_length 1024 \
147+
--metadata '{"get_bos_id":0, "get_eos_ids":[1]}' \
148+
--verbose \
149+
--dtype fp32 \
150+
-qmode 8da4w \
151+
${BACKEND_ARGS}
152+
;;
153+
154+
spark_x2_5_4b)
155+
echo "Running Spark-X2.5-4B export..."
156+
HF_MODEL_DIR="${RUNNER_TEMP:-/tmp}/hf_cache/spark_x2_5_4b"
157+
mkdir -p "${HF_MODEL_DIR}"
158+
hf download --local-dir "${HF_MODEL_DIR}" XHToken/Spark-X2.5-4B
159+
EXPECTED_MODEL_SIZE_UPPER_BOUND=$((5 * 1024 * 1024 * 1024)) # 5GB
160+
$PYTHON_EXECUTABLE -m executorch.examples.models.spark_x2_5.convert_weights \
161+
$HF_MODEL_DIR \
162+
pytorch_model_converted.bin
163+
164+
$PYTHON_EXECUTABLE -m executorch.examples.models.llama.export_llama \
165+
--model "spark_x2_5_4b" \
166+
--checkpoint pytorch_model_converted.bin \
167+
--params examples/models/spark_x2_5/config/spark_x2_5_4b_config.json \
168+
--output_name $MODEL_OUT \
169+
-kv \
170+
--use_sdpa_with_kv_cache \
171+
--max_context_length 1024 \
172+
--max_seq_length 1024 \
173+
--metadata '{"get_bos_id":0, "get_eos_ids":[1]}' \
174+
--verbose \
175+
--dtype fp32 \
176+
-qmode 8da4w \
177+
${BACKEND_ARGS}
178+
;;
179+
128180
*)
129181
echo "Error: unsupported model_name '$MODEL_NAME'"
130-
echo "Supported values: qwen3_4b, phi_4_mini, lfm2_5_1_2b"
182+
echo "Supported values: qwen3_4b, phi_4_mini, lfm2_5_1_2b, spark_x2_5_1_7b, spark_x2_5_4b"
131183
exit 1
132184
;;
133185
esac

‎.github/workflows/trunk.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ jobs:
575575
contents: read
576576
strategy:
577577
matrix:
578-
model: [qwen3_4b, phi_4_mini, lfm2_5_1_2b]
578+
model: [qwen3_4b, phi_4_mini, lfm2_5_1_2b, spark_x2_5_1_7b, spark_x2_5_4b]
579579
runner: [mt-l-x86iavx512-8-64]
580580
docker-image: [executorch-ubuntu-22.04-clang12]
581581
backend: [xnnpack]
@@ -592,6 +592,14 @@ jobs:
592592
runner: mt-l-arm64g4-16-62
593593
docker-image: executorch-ubuntu-22.04-gcc11-aarch64
594594
backend: torchao
595+
- model: spark_x2_5_1_7b
596+
runner: mt-l-arm64g4-16-62
597+
docker-image: executorch-ubuntu-22.04-gcc11-aarch64
598+
backend: torchao
599+
- model: spark_x2_5_4b
600+
runner: mt-l-arm64g4-16-62
601+
docker-image: executorch-ubuntu-22.04-gcc11-aarch64
602+
backend: torchao
595603
fail-fast: false
596604
with:
597605
runner: ${{ matrix.runner }}

0 commit comments

Comments
 (0)