Skip to content

Fix reporting backends and dtyep to benchmark results #6023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/scripts/test_llama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ else
fi

# Check dtype.
EXPORTED_MODEL_NAME="llama2"
EXPORTED_MODEL_NAME="tinyllama_${MODE}_${DTYPE}"
if [[ "${DTYPE}" == "fp16" ]]; then
EXPORTED_MODEL_NAME="${EXPORTED_MODEL_NAME}_h"
elif [[ "${DTYPE}" == "bf16" ]]; then
Expand Down
22 changes: 14 additions & 8 deletions .ci/scripts/test_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,30 +155,24 @@ test_model_with_qnn() {

if [[ "${MODEL_NAME}" == "dl3" ]]; then
EXPORT_SCRIPT=deeplab_v3
EXPORTED_MODEL_NAME=dlv3_qnn.pte
elif [[ "${MODEL_NAME}" == "mv3" ]]; then
EXPORT_SCRIPT=mobilenet_v3
EXPORTED_MODEL_NAME=mv3_qnn.pte
elif [[ "${MODEL_NAME}" == "mv2" ]]; then
EXPORT_SCRIPT=mobilenet_v2
EXPORTED_MODEL_NAME=mv2_qnn.pte
elif [[ "${MODEL_NAME}" == "ic4" ]]; then
EXPORT_SCRIPT=inception_v4
EXPORTED_MODEL_NAME=ic4_qnn.pte
elif [[ "${MODEL_NAME}" == "ic3" ]]; then
EXPORT_SCRIPT=inception_v3
EXPORTED_MODEL_NAME=ic3_qnn.pte
elif [[ "${MODEL_NAME}" == "vit" ]]; then
EXPORT_SCRIPT=torchvision_vit
EXPORTED_MODEL_NAME=vit_qnn.pte
fi

# Use SM8450 for S22, SM8550 for S23, and SM8560 for S24
# TODO(guangyang): Make QNN chipset matches the target device
QNN_CHIPSET=SM8450

"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m ${QNN_CHIPSET} --compile_only
EXPORTED_MODEL=./${EXPORT_SCRIPT}/${EXPORTED_MODEL_NAME}
EXPORTED_MODEL=$(find "./${EXPORT_SCRIPT}" -type f -name "${MODEL_NAME}*.pte" -print -quit)
}

test_model_with_coreml() {
Expand All @@ -187,8 +181,20 @@ test_model_with_coreml() {
exit 1
fi

"${PYTHON_EXECUTABLE}" -m examples.apple.coreml.scripts.export --model_name="${MODEL_NAME}"
DTYPE=float16

"${PYTHON_EXECUTABLE}" -m examples.apple.coreml.scripts.export --model_name="${MODEL_NAME}" --compute_precision "${DTYPE}"
EXPORTED_MODEL=$(find "." -type f -name "${MODEL_NAME}*.pte" -print -quit)
# TODO:
if [ -n "$EXPORTED_MODEL" ]; then
EXPORTED_MODEL_WITH_DTYPE="${EXPORTED_MODEL%.pte}_${DTYPE}.pte"
mv "$EXPORTED_MODEL" "$EXPORTED_MODEL_WITH_DTYPE"
EXPORTED_MODEL="$EXPORTED_MODEL_WITH_DTYPE"
echo "Renamed file path: $EXPORTED_MODEL"
else
echo "No .pte file found"
exit 1
fi
}

if [[ "${BACKEND}" == "portable" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/deeplab_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def main(args):
data_size=data_num, dataset_dir=args.artifact, download=args.download
)

pte_filename = "dlv3_qnn"
pte_filename = "dl3_qnn_q8"
instance = DeepLabV3ResNet101Model()

build_executorch_binary(
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/edsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main(args):
)

inputs, targets, input_list = dataset.lr, dataset.hr, dataset.get_input_list()
pte_filename = "edsr_qnn"
pte_filename = "edsr_qnn_q8"
instance = EdsrModel()

build_executorch_binary(
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/inception_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main(args):
image_shape=(256, 256),
crop_size=224,
)
pte_filename = "ic3_qnn"
pte_filename = "ic3_qnn_q8"
instance = InceptionV3Model()
build_executorch_binary(
instance.get_eager_model().eval(),
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/inception_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main(args):
data_size=data_num,
image_shape=(299, 299),
)
pte_filename = "ic4_qnn"
pte_filename = "ic4_qnn_q8"
instance = InceptionV4Model()
build_executorch_binary(
instance.get_eager_model().eval(),
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/mobilenet_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main(args):
image_shape=(256, 256),
crop_size=224,
)
pte_filename = "mv2_qnn"
pte_filename = "mv2_qnn_q8"
instance = MV2Model()
build_executorch_binary(
instance.get_eager_model().eval(),
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/mobilenet_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main(args):
image_shape=(256, 256),
crop_size=224,
)
pte_filename = "mv3_qnn"
pte_filename = "mv3_qnn_float16"
instance = MV3Model()
build_executorch_binary(
instance.get_eager_model().eval(),
Expand Down
2 changes: 1 addition & 1 deletion examples/qualcomm/scripts/torchvision_vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main(args):
crop_size=224,
)

pte_filename = "vit_qnn"
pte_filename = "vit_qnn_q8"
instance = TorchVisionViTModel()
build_executorch_binary(
instance.get_eager_model().eval(),
Expand Down
Loading