Skip to content

Commit 7608ab8

Browse files
authored
Decouple model exporting from dataset downloading
Differential Revision: D61950464 Pull Request resolved: #4961
1 parent 49b4dde commit 7608ab8

File tree

8 files changed

+60
-28
lines changed

8 files changed

+60
-28
lines changed

.ci/scripts/test.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,24 @@ test_model_with_qnn() {
156156
export PYTHONPATH=$EXECUTORCH_ROOT/..
157157

158158
if [[ "${MODEL_NAME}" == "dl3" ]]; then
159-
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.deeplab_v3 -b ${CMAKE_OUTPUT_DIR} -m SM8550 --compile_only --download
160-
EXPORTED_MODEL=./deeplab_v3/dlv3_qnn.pte
159+
EXPORT_SCRIPT=deeplab_v3
160+
EXPORTED_MODEL_NAME=dlv3_qnn.pte
161+
elif [[ "${MODEL_NAME}" == "mv3" ]]; then
162+
EXPORT_SCRIPT=mobilenet_v3
163+
EXPORTED_MODEL_NAME=mv3_qnn.pte
164+
elif [[ "${MODEL_NAME}" == "mv2" ]]; then
165+
EXPORT_SCRIPT=mobilenet_v2
166+
EXPORTED_MODEL_NAME=mv2_qnn.pte
167+
elif [[ "${MODEL_NAME}" == "ic4" ]]; then
168+
EXPORT_SCRIPT=inception_v4
169+
EXPORTED_MODEL_NAME=ic4_qnn.pte
170+
elif [[ "${MODEL_NAME}" == "ic3" ]]; then
171+
EXPORT_SCRIPT=inception_v3
172+
EXPORTED_MODEL_NAME=ic3_qnn.pte
161173
fi
174+
175+
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m SM8550 --compile_only
176+
EXPORTED_MODEL=./${EXPORT_SCRIPT}/${EXPORTED_MODEL_NAME}
162177
}
163178

164179
if [[ "${BACKEND}" == "portable" ]]; then

.github/workflows/android-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ jobs:
8484
# Separate default values from the workflow dispatch. To ensure defaults are accessible
8585
# during scheduled runs and to provide flexibility for different defaults between
8686
# on-demand and periodic benchmarking.
87-
CRON_DEFAULT_MODELS: "stories110M"
87+
CRON_DEFAULT_MODELS: "dl3,mv3,mv2,ic4,ic3"
8888
CRON_DEFAULT_DEVICES: "samsung_galaxy_s2x"
89-
CRON_DEFAULT_DELEGATES: "xnnpack"
89+
CRON_DEFAULT_DELEGATES: "xnnpack,qnn"
9090
run: |
9191
set -ex
9292
MODELS="${{ inputs.models }}"

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ jobs:
305305
strategy:
306306
matrix:
307307
dtype: [fp32]
308-
model: [dl3]
308+
model: [dl3, mv3, mv2, ic4, ic3]
309309
fail-fast: false
310310
with:
311311
runner: linux.2xlarge

examples/qualcomm/scripts/deeplab_v3.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from multiprocessing.connection import Client
1313

1414
import numpy as np
15+
import torch
1516

1617
from executorch.backends.qualcomm.quantizer.quantizer import QuantDtype
1718
from executorch.examples.models.deeplab_v3 import DeepLabV3ResNet101Model
@@ -74,9 +75,13 @@ def main(args):
7475
)
7576

7677
data_num = 100
77-
inputs, targets, input_list = get_dataset(
78-
data_size=data_num, dataset_dir=args.artifact, download=args.download
79-
)
78+
if args.compile_only:
79+
inputs = [(torch.rand(1, 3, 224, 224),)]
80+
else:
81+
inputs, targets, input_list = get_dataset(
82+
data_size=data_num, dataset_dir=args.artifact, download=args.download
83+
)
84+
8085
pte_filename = "dlv3_qnn"
8186
instance = DeepLabV3ResNet101Model()
8287

examples/qualcomm/scripts/inception_v3.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ def main(args):
7171
)
7272

7373
data_num = 100
74-
inputs, targets, input_list = get_dataset(
75-
dataset_path=f"{args.dataset}",
76-
data_size=data_num,
77-
)
74+
if args.compile_only:
75+
inputs = [(torch.rand(1, 3, 224, 224),)]
76+
else:
77+
inputs, targets, input_list = get_dataset(
78+
dataset_path=f"{args.dataset}",
79+
data_size=data_num,
80+
)
7881
pte_filename = "ic3_qnn"
7982
instance = InceptionV3Model()
8083
build_executorch_binary(
@@ -142,7 +145,7 @@ def main(args):
142145
"for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
143146
),
144147
type=str,
145-
required=True,
148+
required=False,
146149
)
147150

148151
parser.add_argument(

examples/qualcomm/scripts/inception_v4.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ def main(args):
7070
)
7171

7272
data_num = 100
73-
inputs, targets, input_list = get_dataset(
74-
dataset_path=f"{args.dataset}",
75-
data_size=data_num,
76-
)
73+
if args.compile_only:
74+
inputs = [(torch.rand(1, 3, 224, 224),)]
75+
else:
76+
inputs, targets, input_list = get_dataset(
77+
dataset_path=f"{args.dataset}",
78+
data_size=data_num,
79+
)
7780
pte_filename = "ic4_qnn"
7881
instance = InceptionV4Model()
7982
build_executorch_binary(
@@ -141,7 +144,7 @@ def main(args):
141144
"for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
142145
),
143146
type=str,
144-
required=True,
147+
required=False,
145148
)
146149

147150
parser.add_argument(

examples/qualcomm/scripts/mobilenet_v2.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ def main(args):
7171
)
7272

7373
data_num = 100
74-
inputs, targets, input_list = get_dataset(
75-
dataset_path=f"{args.dataset}",
76-
data_size=data_num,
77-
)
74+
if args.compile_only:
75+
inputs = [(torch.rand(1, 3, 224, 224),)]
76+
else:
77+
inputs, targets, input_list = get_dataset(
78+
dataset_path=f"{args.dataset}",
79+
data_size=data_num,
80+
)
7881
pte_filename = "mv2_qnn"
7982
instance = MV2Model()
8083
build_executorch_binary(
@@ -142,7 +145,7 @@ def main(args):
142145
"for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
143146
),
144147
type=str,
145-
required=True,
148+
required=False,
146149
)
147150

148151
parser.add_argument(

examples/qualcomm/scripts/mobilenet_v3.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ def main(args):
7070
)
7171

7272
data_num = 100
73-
inputs, targets, input_list = get_dataset(
74-
dataset_path=f"{args.dataset}",
75-
data_size=data_num,
76-
)
73+
if args.compile_only:
74+
inputs = [(torch.rand(1, 3, 224, 224),)]
75+
else:
76+
inputs, targets, input_list = get_dataset(
77+
dataset_path=f"{args.dataset}",
78+
data_size=data_num,
79+
)
7780
pte_filename = "mv3_qnn"
7881
instance = MV3Model()
7982
build_executorch_binary(
@@ -140,7 +143,7 @@ def main(args):
140143
"for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
141144
),
142145
type=str,
143-
required=True,
146+
required=False,
144147
)
145148

146149
parser.add_argument(

0 commit comments

Comments
 (0)