Skip to content

Commit 9554826

Browse files
authored
Revert "Qualcomm AI Engine Direct - CI for Non-LLM GA model" (#12166)
Reverts #11357 This job is causing CI to fail because it takes too long and preventing viable/strict from updating. @winskuo-quic please re-land with higher timeout.
1 parent 967cfae commit 9554826

File tree

8 files changed

+45
-90
lines changed

8 files changed

+45
-90
lines changed

.ci/scripts/test_model.sh

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -188,22 +188,6 @@ 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
207191
elif [[ "${MODEL_NAME}" == "albert" ]]; then
208192
EXPORT_SCRIPT=albert
209193
elif [[ "${MODEL_NAME}" == "bert" ]]; then
@@ -212,8 +196,6 @@ test_model_with_qnn() {
212196
EXPORT_SCRIPT=distilbert
213197
elif [[ "${MODEL_NAME}" == "eurobert" ]]; then
214198
EXPORT_SCRIPT=eurobert
215-
elif [[ "${MODEL_NAME}" == "roberta" ]]; then
216-
EXPORT_SCRIPT=roberta
217199
else
218200
echo "Unsupported model $MODEL_NAME"
219201
exit 1
@@ -228,13 +210,10 @@ test_model_with_qnn() {
228210
"dl3"|"mv3"|"mv2"|"ic4"|"ic3"|"vit"|"mb"|"w2l")
229211
SCRIPT_FOLDER=scripts
230212
;;
231-
"cvt"|"dit"|"focalnet"|"mobilevit_v2"|"pvt"|"swin")
232-
SCRIPT_FOLDER=oss_scripts
233-
;;
234-
"albert"|"bert"|"distilbert"|"roberta"|"efficientnet"|"mobilevit_v1")
213+
"albert"|"bert"|"distilbert")
235214
pip install evaluate
236215
SCRIPT_FOLDER=oss_scripts
237-
# 16bit models will encounter op validation fail on some operations,
216+
# Bert models running in 16bit will encounter op validation fail on some operations,
238217
# which requires CHIPSET >= SM8550.
239218
QNN_CHIPSET=SM8550
240219
;;

.github/workflows/trunk.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ jobs:
500500
docker-image: executorch-ubuntu-22.04-qnn-sdk
501501
submodules: 'recursive'
502502
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
503-
timeout: 90
503+
timeout: 900
504504
script: |
505505
# The generic Linux job chooses to use base env, not the one setup by the image
506506
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
@@ -519,14 +519,14 @@ jobs:
519519
strategy:
520520
matrix:
521521
dtype: [fp32]
522-
model: [cvt, dit, efficientnet, focalnet, mobilevit_v1, mobilevit_v2, pvt, swin, albert, bert, distilbert, roberta] # eurobert requires transfomer >= 4.48.0, skip for now
522+
model: [albert, bert, distilbert] # eurobert requires transfomer >= 4.48.0, skip for now
523523
fail-fast: false
524524
with:
525525
runner: linux.2xlarge
526526
docker-image: executorch-ubuntu-22.04-qnn-sdk
527527
submodules: 'recursive'
528528
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
529-
timeout: 90
529+
timeout: 900
530530
script: |
531531
# The generic Linux job chooses to use base env, not the one setup by the image
532532
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")

backends/qualcomm/builders/op_slice_copy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def define_node(
5656
if start < 0:
5757
start = start % input_tensor.shape[dim]
5858

59-
if len(node.args) > 3 and node.args[3] is not None:
59+
if len(node.args) > 3:
6060
end = min(cast(int, node.args[3]), input_tensor.shape[dim])
6161
if end < 0:
6262
end = end % input_tensor.shape[dim]

backends/qualcomm/tests/test_qnn_delegate.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4585,13 +4585,14 @@ def test_gMLP(self):
45854585
self.assertGreaterEqual(msg["top_1"], 60)
45864586
self.assertGreaterEqual(msg["top_5"], 85)
45874587

4588-
def test_mobilevit_v1(self):
4588+
@unittest.skip("Only outputs good accuracy in QNN 2.29")
4589+
def test_mobilevit_v2(self):
45894590
if not self.required_envs([self.image_dataset]):
45904591
self.skipTest("missing required envs")
45914592

45924593
cmds = [
45934594
"python",
4594-
f"{self.executorch_root}/examples/qualcomm/oss_scripts/mobilevit_v1.py"
4595+
f"{self.executorch_root}/examples/qualcomm/oss_scripts/mobilevit_v2.py",
45954596
"--dataset",
45964597
self.image_dataset,
45974598
"--artifact",
@@ -4609,6 +4610,8 @@ def test_mobilevit_v1(self):
46094610
]
46104611
if self.host:
46114612
cmds.extend(["--host", self.host])
4613+
if self.shared_buffer:
4614+
cmds.extend(["--shared_buffer"])
46124615

46134616
p = subprocess.Popen(cmds, stdout=subprocess.DEVNULL)
46144617
with Listener((self.ip, self.port)) as listener:
@@ -4618,22 +4621,17 @@ def test_mobilevit_v1(self):
46184621
if "Error" in msg:
46194622
self.fail(msg["Error"])
46204623
else:
4621-
self.assertGreaterEqual(msg["top_1"], 70)
4624+
self.assertGreaterEqual(msg["top_1"], 50)
46224625
self.assertGreaterEqual(msg["top_5"], 85)
46234626

4624-
@unittest.skip("Only outputs good accuracy in QNN 2.29")
4625-
def test_mobilevit_v2(self):
4627+
def test_pvt(self):
46264628
if not self.required_envs([self.image_dataset]):
46274629
self.skipTest("missing required envs")
46284630

46294631
cmds = [
46304632
"python",
4631-
f"{self.executorch_root}/examples/qualcomm/oss_scripts/mobilevit_v2.py",
4632-
"--dataset",
4633+
f"{self.executorch_root}/examples/qualcomm/oss_scripts/pvt.py",
46334634
self.image_dataset,
4634-
"--artifact",
4635-
self.artifact_dir,
4636-
"--build_folder",
46374635
self.build_folder,
46384636
"--device",
46394637
self.device,
@@ -4646,8 +4644,6 @@ def test_mobilevit_v2(self):
46464644
]
46474645
if self.host:
46484646
cmds.extend(["--host", self.host])
4649-
if self.shared_buffer:
4650-
cmds.extend(["--shared_buffer"])
46514647

46524648
p = subprocess.Popen(cmds, stdout=subprocess.DEVNULL)
46534649
with Listener((self.ip, self.port)) as listener:
@@ -4657,17 +4653,21 @@ def test_mobilevit_v2(self):
46574653
if "Error" in msg:
46584654
self.fail(msg["Error"])
46594655
else:
4660-
self.assertGreaterEqual(msg["top_1"], 50)
4656+
self.assertGreaterEqual(msg["top_1"], 65)
46614657
self.assertGreaterEqual(msg["top_5"], 85)
46624658

4663-
def test_pvt(self):
4659+
def test_mobilevit1(self):
46644660
if not self.required_envs([self.image_dataset]):
46654661
self.skipTest("missing required envs")
46664662

46674663
cmds = [
46684664
"python",
4669-
f"{self.executorch_root}/examples/qualcomm/oss_scripts/pvt.py",
4665+
f"{self.executorch_root}/examples/qualcomm/oss_scripts/mobilevit1.py"
4666+
"--dataset",
46704667
self.image_dataset,
4668+
"--artifact",
4669+
self.artifact_dir,
4670+
"--build_folder",
46714671
self.build_folder,
46724672
"--device",
46734673
self.device,
@@ -4689,7 +4689,7 @@ def test_pvt(self):
46894689
if "Error" in msg:
46904690
self.fail(msg["Error"])
46914691
else:
4692-
self.assertGreaterEqual(msg["top_1"], 65)
4692+
self.assertGreaterEqual(msg["top_1"], 70)
46934693
self.assertGreaterEqual(msg["top_5"], 85)
46944694

46954695
def test_regnet(self):

examples/qualcomm/oss_scripts/deit.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
import getpass
88
import json
9-
import logging
109
import os
1110
from multiprocessing.connection import Client
1211

1312
import numpy as np
14-
import torch
1513
from executorch.backends.qualcomm._passes.qnn_pass_manager import (
1614
get_capture_program_passes,
1715
)
@@ -48,23 +46,16 @@ def main(args):
4846
data_num = 100
4947
height = config.image_size
5048
width = config.image_size
51-
52-
if args.ci:
53-
inputs = [(torch.rand(1, 3, height, width),)]
54-
logging.warning(
55-
"This option is for CI to verify the export flow. It uses random input and will result in poor accuracy."
56-
)
57-
else:
58-
inputs, targets, input_list = get_imagenet_dataset(
59-
dataset_path=f"{args.dataset}",
60-
data_size=data_num,
61-
image_shape=(height, width),
62-
crop_size=(height, width),
63-
)
49+
inputs, targets, input_list = get_imagenet_dataset(
50+
dataset_path=f"{args.dataset}",
51+
data_size=data_num,
52+
image_shape=(height, width),
53+
crop_size=(height, width),
54+
)
6455

6556
# Get the Deit model.
6657
model = get_instance()
67-
pte_filename = "deit_qnn_q8"
58+
pte_filename = "deit_qnn"
6859

6960
# lower to QNN
7061
passes_job = get_capture_program_passes()
@@ -129,8 +120,8 @@ def main(args):
129120
parser.add_argument(
130121
"-a",
131122
"--artifact",
132-
help="path for storing generated artifacts and output by this example. Default ./deit",
133-
default="./deit",
123+
help="path for storing generated artifacts and output by this example. Default ./deit_qnn",
124+
default="./deit_qnn",
134125
type=str,
135126
)
136127

@@ -143,7 +134,7 @@ def main(args):
143134
"for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
144135
),
145136
type=str,
146-
required=False,
137+
required=True,
147138
)
148139

149140
args = parser.parse_args()

examples/qualcomm/oss_scripts/mobilevit_v1.py renamed to examples/qualcomm/oss_scripts/mobilevit1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def main(args):
8484
.to("cpu")
8585
)
8686

87-
pte_filename = "mobilevit_v1_qnn_q16"
87+
pte_filename = "mobilevit1_qnn_q16"
8888
build_executorch_binary(
8989
module.eval(),
9090
inputs[0],
@@ -157,8 +157,8 @@ def main(args):
157157
"-a",
158158
"--artifact",
159159
help="path for storing generated artifacts by this example. "
160-
"Default ./mobilevit_v1",
161-
default="./mobilevit_v1",
160+
"Default ./mobilevit1",
161+
default="./mobilevit1",
162162
type=str,
163163
)
164164

examples/qualcomm/oss_scripts/roberta.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import getpass
88
import json
9-
import logging
109
import os
1110
from multiprocessing.connection import Client
1211

@@ -39,29 +38,16 @@ def main(args):
3938
skip_node_id_set, skip_node_op_set = parse_skip_delegation_node(args)
4039

4140
os.makedirs(args.artifact, exist_ok=True)
41+
data_size = 100
4242

4343
tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-base")
44-
data_size = 100
45-
if args.ci:
46-
random_ids = torch.randint(low=0, high=100, size=(1, 100), dtype=torch.int32)
47-
attention_mask = torch.ones((1, 100), dtype=torch.float32)
48-
inputs = [
49-
(
50-
random_ids,
51-
attention_mask,
52-
)
53-
]
54-
logging.warning(
55-
"This option is for CI to verify the export flow. It uses random input and will result in poor accuracy."
56-
)
57-
else:
58-
inputs, targets, input_list = get_masked_language_model_dataset(
59-
args.dataset, tokenizer, data_size
60-
)
44+
inputs, targets, input_list = get_masked_language_model_dataset(
45+
args.dataset, tokenizer, data_size
46+
)
6147

6248
# Get the Roberta model.
6349
model = get_instance(args)
64-
pte_filename = "roberta_qnn_q16"
50+
pte_filename = "roberta_qnn"
6551

6652
# lower to QNN
6753
passes_job = get_capture_program_passes()
@@ -151,7 +137,7 @@ def main(args):
151137
"-a",
152138
"--artifact",
153139
help="path for storing generated artifacts and output by this example. Default ./Roberta_qnn",
154-
default="./roberta",
140+
default="./Roberta_qnn",
155141
type=str,
156142
)
157143
parser.add_argument(
@@ -163,7 +149,7 @@ def main(args):
163149
"for https://www.kaggle.com/datasets/mikeortman/wikipedia-sentences"
164150
),
165151
type=str,
166-
required=False,
152+
required=True,
167153
)
168154

169155
args = parser.parse_args()

examples/qualcomm/oss_scripts/swin_transformer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def main(args):
8989

9090
data_num = 100
9191
if args.ci:
92-
inputs = [(torch.rand(1, 3, 224, 224),)]
92+
inputs = [torch.rand(1, 3, 224, 224)]
9393
logging.warning(
9494
"This option is for CI to verify the export flow. It uses random input and will result in poor accuracy."
9595
)
@@ -181,9 +181,8 @@ def main(args):
181181
parser.add_argument(
182182
"-a",
183183
"--artifact",
184-
help="path for storing generated artifacts by this example. "
185-
"Default ./swin_transformer",
186-
default="./swin_transformer",
184+
help="path for storing generated artifacts by this example. " "Default ./swin",
185+
default="./swin",
187186
type=str,
188187
)
189188

0 commit comments

Comments
 (0)