5757}
5858
5959# Hosting lora adapter in personal repo for now.
60+ # The Hugging Face downloads below are pinned to commits the read-only
61+ # CI cache holds. To bump a pin, seed the cache first from a pytorch/executorch
62+ # branch (forks cannot write the cache): run pull.yml on it with
63+ # workflow_dispatch, or push to it after its pull request has the
64+ # ci-refresh-hf-cache label.
6065python -m pip install -q huggingface_hub
6166HF_ADAPTER_REPO=" lucylq/qwen3_06B_lora_math"
6267HF_ADAPTER_PATH=$(
6368 bash " $( dirname " ${BASH_SOURCE[0]} " ) /download_hf_hub.sh" \
6469 --model_id " ${HF_ADAPTER_REPO} " \
70+ --revision 0e6bc3a88a597c5abc4872734eec8db3a9fdd846 \
6571 --files " adapter_config.json" " adapter_model.safetensors"
6672)
6773
6874# Set environment variables for OmegaConf interpolation in yaml.
6975export LORA_ADAPTER_CHECKPOINT=" ${HF_ADAPTER_PATH} /adapter_model.safetensors"
7076export LORA_ADAPTER_CONFIG=" ${HF_ADAPTER_PATH} /adapter_config.json"
7177
78+ # Without a checkpoint, export downloads Qwen/Qwen3-0.6B from its main branch,
79+ # so convert the pinned commit the read-only CI cache holds instead.
80+ QWEN_SNAPSHOT=$( $PYTHON_EXECUTABLE -m executorch.examples.models.llama.hf_download \
81+ snapshot Qwen/Qwen3-0.6B --revision c1899de289a04d12100db370d81485cdf75e47ca)
82+ QWEN_CHECKPOINT_DIR=$( mktemp -d " ${RUNNER_TEMP:-/ tmp} /qwen3_0_6b_XXXXXX" )
83+ trap ' rm -rf "${QWEN_CHECKPOINT_DIR}"' EXIT
84+ QWEN_CHECKPOINT=" ${QWEN_CHECKPOINT_DIR} /qwen3_0_6b.pth"
85+ $PYTHON_EXECUTABLE -m executorch.examples.models.qwen3.convert_weights \
86+ " ${QWEN_SNAPSHOT} " " ${QWEN_CHECKPOINT} "
87+
7288# ## SINGLE LORA PTE ###
7389# Export LoRA PTE file.
7490$PYTHON_EXECUTABLE -m extension.llm.export.export_llm \
7591 --config examples/models/qwen3/config/qwen3_xnnpack_lora.yaml \
92+ +base.checkpoint=" ${QWEN_CHECKPOINT} " \
7693 +export.output_name=" qwen_lora_math_full.pte"
7794
7895# Capture the path of the downloaded qwen artifacts
79- HF_QWEN_PATH=$(python -c "from huggingface_hub import snapshot_download; print(snapshot_download('unsloth/Qwen3-0.6B'))")
96+ HF_QWEN_PATH=$( python -c " from huggingface_hub import snapshot_download; print(snapshot_download('unsloth/Qwen3-0.6B', revision='db4e90b8359f816f09bf5c944797ce116f26da3c' ))" )
8097echo " Model downloaded to: $HF_QWEN_PATH "
8198
8299# ## BUILD LLAMA RUNNER.
120137# Export LoRA PTE, LoRA PTD, foundation PTD file.
121138$PYTHON_EXECUTABLE -m extension.llm.export.export_llm \
122139 --config examples/models/qwen3/config/qwen3_xnnpack_lora.yaml \
140+ +base.checkpoint=" ${QWEN_CHECKPOINT} " \
123141 +export.output_name=" qwen_lora_math.pte" \
124142 +export.foundation_weights_file=" qwen_foundation.ptd" \
125143 +export.lora_weights_file=" qwen_lora_math.ptd"
@@ -179,6 +197,7 @@ The answer is: 12<|im_end|>"
179197# and loading lora weights.
180198$PYTHON_EXECUTABLE -m extension.llm.export.export_llm \
181199 --config examples/models/qwen3/config/qwen3_xnnpack_lora.yaml \
200+ +base.checkpoint=" ${QWEN_CHECKPOINT} " \
182201 base.lora_config=null \
183202 +export.output_name=" qwen_q.pte" \
184203 +export.foundation_weights_file=" qwen_foundation_q.ptd" \
@@ -188,6 +207,7 @@ $PYTHON_EXECUTABLE -m extension.llm.export.export_llm \
188207# Export Quantized LoRA PTE, LoRA PTD, foundation PTD file.
189208$PYTHON_EXECUTABLE -m extension.llm.export.export_llm \
190209 --config examples/models/qwen3/config/qwen3_xnnpack_lora.yaml \
210+ +base.checkpoint=" ${QWEN_CHECKPOINT} " \
191211 +export.output_name=" qwen_lora_math_q.pte" \
192212 +export.foundation_weights_file=" qwen_foundation_lora_q.ptd" \
193213 +export.lora_weights_file=" qwen_lora_math_q.ptd" \
0 commit comments