@@ -188,6 +188,22 @@ test_model_with_qnn() {
188188 EXPORT_SCRIPT=edsr
189189 # Additional deps for edsr
190190 pip install piq
191+ elif [[ " ${MODEL_NAME} " == " cvt" ]]; then
192+ EXPORT_SCRIPT=cvt
193+ elif [[ " ${MODEL_NAME} " == " dit" ]]; then
194+ EXPORT_SCRIPT=dit
195+ elif [[ " ${MODEL_NAME} " == " efficientnet" ]]; then
196+ EXPORT_SCRIPT=efficientnet
197+ elif [[ " ${MODEL_NAME} " == " focalnet" ]]; then
198+ EXPORT_SCRIPT=focalnet
199+ elif [[ " ${MODEL_NAME} " == " mobilevit_v1" ]]; then
200+ EXPORT_SCRIPT=mobilevit_v1
201+ elif [[ " ${MODEL_NAME} " == " mobilevit_v2" ]]; then
202+ EXPORT_SCRIPT=mobilevit_v2
203+ elif [[ " ${MODEL_NAME} " == " pvt" ]]; then
204+ EXPORT_SCRIPT=pvt
205+ elif [[ " ${MODEL_NAME} " == " swin" ]]; then
206+ EXPORT_SCRIPT=swin_transformer
191207 elif [[ " ${MODEL_NAME} " == " albert" ]]; then
192208 EXPORT_SCRIPT=albert
193209 elif [[ " ${MODEL_NAME} " == " bert" ]]; then
@@ -196,6 +212,8 @@ test_model_with_qnn() {
196212 EXPORT_SCRIPT=distilbert
197213 elif [[ " ${MODEL_NAME} " == " eurobert" ]]; then
198214 EXPORT_SCRIPT=eurobert
215+ elif [[ " ${MODEL_NAME} " == " roberta" ]]; then
216+ EXPORT_SCRIPT=roberta
199217 else
200218 echo " Unsupported model $MODEL_NAME "
201219 exit 1
@@ -210,10 +228,13 @@ test_model_with_qnn() {
210228 " dl3" |" mv3" |" mv2" |" ic4" |" ic3" |" vit" |" mb" |" w2l" )
211229 SCRIPT_FOLDER=scripts
212230 ;;
213- " albert" |" bert" |" distilbert" )
231+ " cvt" |" dit" |" focalnet" |" mobilevit_v2" |" pvt" |" swin" )
232+ SCRIPT_FOLDER=oss_scripts
233+ ;;
234+ " albert" |" bert" |" distilbert" |" roberta" |" efficientnet" |" mobilevit_v1" )
214235 pip install evaluate
215236 SCRIPT_FOLDER=oss_scripts
216- # Bert models running in 16bit will encounter op validation fail on some operations,
237+ # 16bit models will encounter op validation fail on some operations,
217238 # which requires CHIPSET >= SM8550.
218239 QNN_CHIPSET=SM8550
219240 ;;
@@ -232,21 +253,24 @@ test_model_with_qnn() {
232253# @param should_test If true, build and test the model using the coreml_executor_runner.
233254test_model_with_coreml () {
234255 local should_test=" $1 "
256+ local test_with_pybindings=" $2 "
257+ local dtype=" $3 "
235258
236259 if [[ " ${BUILD_TOOL} " != " cmake" ]]; then
237260 echo " coreml only supports cmake."
238261 exit 1
239262 fi
240263
241- DTYPE=float16
264+ RUN_WITH_PYBINDINGS=" "
265+ if [[ " ${test_with_pybindings} " == true ]]; then
266+ echo \" Running with pybindings\"
267+ export RUN_WITH_PYBINDINGS=" --run_with_pybindings"
268+ fi
242269
243- " ${PYTHON_EXECUTABLE} " -m examples.apple.coreml.scripts.export --model_name=" ${MODEL_NAME} " --compute_precision " ${DTYPE} " --use_partitioner
270+ " ${PYTHON_EXECUTABLE} " -m examples.apple.coreml.scripts.export --model_name=" ${MODEL_NAME} " --compute_precision ${dtype} --use_partitioner ${RUN_WITH_PYBINDINGS}
244271 EXPORTED_MODEL=$( find " ." -type f -name " ${MODEL_NAME} *.pte" -print -quit)
245272
246273 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 "
250274 echo " OK exported model: $EXPORTED_MODEL "
251275 else
252276 echo " [error] failed to export model: no .pte file found"
@@ -303,7 +327,15 @@ elif [[ "${BACKEND}" == *"coreml"* ]]; then
303327 if [[ " ${BACKEND} " == * " test" * ]]; then
304328 should_test_coreml=true
305329 fi
306- test_model_with_coreml " ${should_test_coreml} "
330+ test_with_pybindings=false
331+ if [[ " ${BACKEND} " == * " pybind" * ]]; then
332+ test_with_pybindings=true
333+ fi
334+ dtype=float16
335+ if [[ " ${BACKEND} " == * " float32" * ]]; then
336+ dtype=float32
337+ fi
338+ test_model_with_coreml " ${should_test_coreml} " " ${test_with_pybindings} " " ${dtype} "
307339 if [[ $? -eq 0 ]]; then
308340 prepare_artifacts_upload
309341 fi
0 commit comments