66
77import json
88import os
9+ import sys
910from multiprocessing .connection import Client
1011
1112import numpy as np
@@ -61,10 +62,14 @@ def main(args):
6162 os .makedirs (args .artifact , exist_ok = True )
6263
6364 data_num = 100
64- inputs , targets , input_list = get_dataset (
65- dataset_path = f"{ args .dataset } " ,
66- data_size = data_num ,
67- )
65+ if args .compile_only :
66+ inputs = [(torch .rand (1 , 3 , 224 , 224 ),)]
67+ else :
68+ inputs , targets , input_list = get_dataset (
69+ dataset_path = f"{ args .dataset } " ,
70+ data_size = data_num ,
71+ )
72+
6873 pte_filename = "vit_qnn"
6974 instance = TorchVisionViTModel ()
7075 build_executorch_binary (
@@ -77,6 +82,9 @@ def main(args):
7782 shared_buffer = args .shared_buffer ,
7883 )
7984
85+ if args .compile_only :
86+ sys .exit (0 )
87+
8088 adb = SimpleADB (
8189 qnn_sdk = os .getenv ("QNN_SDK_ROOT" ),
8290 build_path = f"{ args .build_folder } " ,
@@ -126,13 +134,14 @@ def main(args):
126134 "for https://www.kaggle.com/datasets/ifigotin/imagenetmini-1000)"
127135 ),
128136 type = str ,
129- required = True ,
137+ required = False ,
130138 )
131139 parser .add_argument (
132140 "-a" ,
133141 "--artifact" ,
134- help = "path for storing generated artifacts by this example. " "Default ./vit" ,
135- default = "./vit" ,
142+ help = "path for storing generated artifacts by this example. "
143+ "Default ./torchvision_vit" ,
144+ default = "./torchvision_vit" ,
136145 type = str ,
137146 )
138147
0 commit comments