Skip to content

Commit b45ac22

Browse files
committed
init
1 parent f2f2a9d commit b45ac22

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# Copyright (c) Qualcomm Innovation Center, Inc.
3+
# All rights reserved
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -exu
9+
10+
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
11+
12+
MODEL_NAME="$1"
13+
OUTPUT_DIR="$2"
14+
MODEL_ID=""
15+
TASK=""
16+
RECIPE=""
17+
18+
# Map model name to model_id
19+
case "$MODEL_NAME" in
20+
smollm)
21+
MODEL_ID="HuggingFaceTB/SmolLM2-135M"
22+
TASK="text-generation"
23+
RECIPE="coreml_llm_4bit"
24+
;;
25+
llama3)
26+
MODEL_ID="NousResearch/Llama-3.2-1B"
27+
TASK="text-generation"
28+
RECIPE="coreml_llm_4bit"
29+
;;
30+
*)
31+
echo "Error: Unknown model name '$MODEL_NAME'"
32+
exit 1
33+
;;
34+
esac
35+
36+
37+
38+
# Call the CLI tool with the resolved model_id
39+
echo "Exporting model: $MODEL_NAME (ID: $MODEL_ID, TASK: $TASK, RECIPE: $RECIPE)"
40+
optimum-cli export executorch \
41+
--model "${MODEL_ID}" \
42+
--task "${TASK}" \
43+
--recipe "${RECIPE}" \
44+
--output_dir ${OUTPUT_DIR}

.github/workflows/trunk.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ jobs:
240240
241241
cxx_flags="-fno-exceptions -fno-rtti -Wall -Werror -Wno-int-in-bool-context -DET_HAVE_PREAD=0"
242242
setup_script_args=""
243-
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
243+
if [[ ${{ matrix.os}} == "bare_metal" ]]; then
244244
toolchain_prefix=arm-none-eabi-
245245
threshold="103268" # ~100KiB
246246
toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
247-
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
247+
elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then
248248
setup_script_args="--target-toolchain zephyr"
249249
toolchain_prefix=arm-zephyr-eabi-
250250
threshold="133120" # should be ~125KB, set threshold to 130KB
@@ -600,6 +600,45 @@ jobs:
600600
echo "::endgroup::"
601601
done
602602
603+
test-coreml-optimum-executorch:
604+
name: test-apple-model
605+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
606+
strategy:
607+
fail-fast: false
608+
with:
609+
runner: macos-m1-stable
610+
python-version: '3.11'
611+
submodules: 'recursive'
612+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
613+
timeout: 90
614+
script: |
615+
BUILD_TOOL=cmake
616+
bash .ci/scripts/setup-conda.sh
617+
618+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
619+
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool "${BUILD_TOOL}"
620+
621+
echo "::group::Set up Hugging Face"
622+
pip install -U "huggingface_hub[cli]"
623+
huggingface-cli login --token $SECRET_EXECUTORCH_HF_TOKEN
624+
OPTIMUM_ET_COMMIT=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
625+
git clone https://github.com/huggingface/optimum-executorch
626+
pushd optimum-executorch
627+
# There is no release yet, for CI stability, always test from the same commit on main
628+
# git checkout $OPTIMUM_ET_COMMIT
629+
gh pr checkout 93
630+
python install_dev.py --skip_override_torch
631+
popd
632+
pip list
633+
echo "::endgroup::"
634+
635+
636+
# Test model export
637+
MODELS=(smollm llama3)
638+
for MODEL_NAME in "${MODELS[@]}"; do
639+
bash .ci/scripts/export_optimum_et_coreml.sh $MODEL_NAME" /tmp/$MODEL_NAME
640+
641+
603642
test-huggingface-transformers:
604643
# NB: Don't run this on fork PRs because they won't have access to the secret and would fail anyway
605644
if: ${{ !github.event.pull_request.head.repo.fork }}

0 commit comments

Comments
 (0)