Skip to content

Commit b0e9aaa

Browse files
author
Guang Yang
committed
Update CI for HF Optimum models
1 parent adde519 commit b0e9aaa

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

.github/workflows/trunk.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,10 @@ jobs:
555555
strategy:
556556
matrix:
557557
hf_model_id: [
558-
google/gemma-2-2b,
559-
Qwen/Qwen2.5-0.5B,
558+
google/gemma-3-1b-it,
559+
Qwen/Qwen3-0.6B,
560560
HuggingFaceTB/SmolLM2-135M,
561-
meta-llama/Llama-3.2-1B,
562-
allenai/OLMo-1B-hf
561+
allenai/OLMo-1B-hf,
563562
]
564563
fail-fast: false
565564
with:
@@ -583,25 +582,37 @@ jobs:
583582
git clone https://github.com/huggingface/optimum-executorch
584583
cd optimum-executorch
585584
# There is no release yet, for CI stability, always test from the same commit on main
586-
git checkout 577a2b19670e4c643a5c6ecb09bf47b9a699e7c6
585+
git checkout da80c9e35b3db5c7eea8731b7d660482fb4870a8
587586
pip install .[tests]
588587
pip list
589588
echo "::endgroup::"
590589
591590
echo "::group::Export and Run ${{ matrix.hf_model_id }}"
592591
# Pass matrix variable as environment variable
593592
export MODEL_ID="${{ matrix.hf_model_id }}"
593+
export OUTPUT_DIR="${MODEL_ID}_custom_sdpa_8da4w"
594+
595+
optimum-cli export executorch \
596+
--model ${MODEL_ID} \
597+
--task text-generation \
598+
--recipe xnnpack \
599+
--use_custom_sdpa \
600+
--output_dir ${OUTPUT_DIR} \
601+
--qlinear
602+
603+
ls -FlAGhp ${OUTPUT_DIR}
604+
594605
python -c "
595606
import os
596607
from optimum.executorch import ExecuTorchModelForCausalLM
597608
from transformers import AutoTokenizer
598609
599610
model_id = os.getenv('MODEL_ID')
600-
print(f'Loading model: {model_id}')
601-
model = ExecuTorchModelForCausalLM.from_pretrained(model_id, recipe='xnnpack')
602-
tokenizer = AutoTokenizer.from_pretrained(model_id)
611+
pte_dir = os.getenv('OUTPUT_DIR')
612+
print(f"Loading model '{model_id}' from '{pte_dir}'.")
613+
model = ExecuTorchModelForCausalLM.from_pretrained(pte_dir)
603614
generated_text = model.text_generation(
604-
tokenizer=tokenizer,
615+
tokenizer=AutoTokenizer.from_pretrained(model_id),
605616
prompt='Simply put, the theory of relativity states that',
606617
max_seq_len=64
607618
)

0 commit comments

Comments
 (0)