Skip to content

Commit fef850f

Browse files
committed
Update base for Update on "CI test for lora"
Add CI test for LoRA: note, not program-data separated yet. Differential Revision: [D78751767](https://our.internmc.facebook.com/intern/diff/D78751767/) [ghstack-poisoned]
2 parents 9a76d16 + 0c8879e commit fef850f

File tree

80 files changed

+3647
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3647
-508
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a3942627f5ac048e06b4b1d703b0a6a53bf6da5b
1+
eea657ddbdeb1118943a92fb73c289985c3ee1ba

.ci/scripts/test_model.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,24 @@ test_model_with_qnn() {
232232
# @param should_test If true, build and test the model using the coreml_executor_runner.
233233
test_model_with_coreml() {
234234
local should_test="$1"
235+
local test_with_pybindings="$2"
236+
local dtype="$3"
235237

236238
if [[ "${BUILD_TOOL}" != "cmake" ]]; then
237239
echo "coreml only supports cmake."
238240
exit 1
239241
fi
240242

241-
DTYPE=float16
243+
RUN_WITH_PYBINDINGS=""
244+
if [[ "${test_with_pybindings}" == true ]]; then
245+
echo \"Running with pybindings\"
246+
export RUN_WITH_PYBINDINGS="--run_with_pybindings"
247+
fi
242248

243-
"${PYTHON_EXECUTABLE}" -m examples.apple.coreml.scripts.export --model_name="${MODEL_NAME}" --compute_precision "${DTYPE}" --use_partitioner
249+
"${PYTHON_EXECUTABLE}" -m examples.apple.coreml.scripts.export --model_name="${MODEL_NAME}" --compute_precision ${dtype} --use_partitioner ${RUN_WITH_PYBINDINGS}
244250
EXPORTED_MODEL=$(find "." -type f -name "${MODEL_NAME}*.pte" -print -quit)
245251

246252
if [ -n "$EXPORTED_MODEL" ]; then
247-
EXPORTED_MODEL_WITH_DTYPE="${EXPORTED_MODEL%.pte}_${DTYPE}.pte"
248-
mv "$EXPORTED_MODEL" "$EXPORTED_MODEL_WITH_DTYPE"
249-
EXPORTED_MODEL="$EXPORTED_MODEL_WITH_DTYPE"
250253
echo "OK exported model: $EXPORTED_MODEL"
251254
else
252255
echo "[error] failed to export model: no .pte file found"
@@ -303,7 +306,15 @@ elif [[ "${BACKEND}" == *"coreml"* ]]; then
303306
if [[ "${BACKEND}" == *"test"* ]]; then
304307
should_test_coreml=true
305308
fi
306-
test_model_with_coreml "${should_test_coreml}"
309+
test_with_pybindings=false
310+
if [[ "${BACKEND}" == *"pybind"* ]]; then
311+
test_with_pybindings=true
312+
fi
313+
dtype=float16
314+
if [[ "${BACKEND}" == *"float32"* ]]; then
315+
dtype=float32
316+
fi
317+
test_model_with_coreml "${should_test_coreml}" "${test_with_pybindings}" "${dtype}"
307318
if [[ $? -eq 0 ]]; then
308319
prepare_artifacts_upload
309320
fi

.github/workflows/android-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ jobs:
355355
"--recipe" "xnnpack"
356356
"--use_custom_sdpa"
357357
"--use_custom_kv_cache"
358-
"--qlinear"
359-
"--qembedding"
358+
"--qlinear" "8da4w"
359+
"--qembedding" "8w"
360360
"--output_dir" ".."
361361
)
362362

.github/workflows/apple-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ jobs:
360360
"--recipe" "xnnpack"
361361
"--use_custom_sdpa"
362362
"--use_custom_kv_cache"
363-
"--qlinear"
364-
"--qembedding"
363+
"--qlinear" "8da4w"
364+
"--qembedding" "8w"
365365
"--output_dir" ".."
366366
)
367367

.github/workflows/trunk.yml

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
test-models-macos:
22-
name: test-models-macos
21+
test-models-macos-cpu:
22+
name: test-models-macos-cpu
2323
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
2424
strategy:
2525
matrix:
@@ -568,10 +568,12 @@ jobs:
568568
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
569569
PYTHON_EXECUTABLE=python bash .ci/scripts/test_model.sh ${{ matrix.model }} "cmake" "qnn"
570570
571-
test-apple-model:
572-
name: test-apple-model
571+
test-models-macos-coreml:
572+
name: test-models-macos-coreml
573573
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
574574
strategy:
575+
matrix:
576+
model: [dl3, edsr, efficient_sam, emformer_join, emformer_transcribe, ic3, ic4, mobilebert, mv2, mv3, resnet50, vit, w2l]
575577
fail-fast: false
576578
with:
577579
runner: macos-m1-stable
@@ -580,7 +582,23 @@ jobs:
580582
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
581583
timeout: 90
582584
script: |
585+
MODEL_NAME=${{ matrix.model }}
583586
BUILD_TOOL=cmake
587+
BACKEND="coreml-pybind"
588+
589+
590+
# Set model specific overrides
591+
if [[ "${MODEL_NAME}" == "mobilebert" ]]; then
592+
# See https://github.com/pytorch/executorch/issues/12907
593+
# mobilebert has nan output on FP16, and high MSE on fp32, so we disable runtime test now
594+
BACKEND="coreml"
595+
fi
596+
597+
if [[ "${MODEL_NAME}" == "efficient_sam" ]]; then
598+
# See https://github.com/pytorch/executorch/issues/12906
599+
# efficient_sam fails to run on CoreML
600+
BACKEND="coreml"
601+
fi
584602
585603
bash .ci/scripts/setup-conda.sh
586604
@@ -589,13 +607,28 @@ jobs:
589607
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash backends/apple/coreml/scripts/install_requirements.sh
590608
echo "Finishing installing coreml."
591609
592-
# Build and test coreml model
593-
MODELS=(mv3 ic4 resnet50 edsr mobilebert w2l)
594-
for MODEL_NAME in "${MODELS[@]}"; do
595-
echo "::group::Exporting coreml model: $MODEL_NAME"
596-
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/test_model.sh "${MODEL_NAME}" "${BUILD_TOOL}" "coreml"
597-
echo "::endgroup::"
610+
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/test_model.sh "${MODEL_NAME}" "${BUILD_TOOL}" "${BACKEND}"
611+
612+
test-models-macos-mps:
613+
name: test-models-macos-mps
614+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
615+
strategy:
616+
fail-fast: false
617+
with:
618+
runner: macos-m1-stable
619+
python-version: '3.11'
620+
submodules: 'recursive'
621+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
622+
timeout: 90
623+
script: |
624+
BUILD_TOOL=cmake
625+
bash .ci/scripts/setup-conda.sh
626+
627+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
628+
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh --build-tool "${BUILD_TOOL}"
598629
630+
# Build and test mps model
631+
for MODEL_NAME in mv3 ic4 resnet50 edsr mobilebert w2l; do
599632
echo "::group::Exporting mps model: $MODEL_NAME"
600633
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/test_model.sh "${MODEL_NAME}" "${BUILD_TOOL}" "mps"
601634
echo "::endgroup::"
@@ -678,8 +711,8 @@ jobs:
678711
"--recipe" "xnnpack"
679712
"--use_custom_sdpa"
680713
"--use_custom_kv_cache"
681-
"--qlinear"
682-
"--qembedding"
714+
"--qlinear" "8da4w"
715+
"--qembedding" "8w"
683716
"--output_dir" "${OUTPUT_DIR}"
684717
)
685718

0 commit comments

Comments
 (0)