46
46
from data_sequences import DATA_SEQUENCES
47
47
48
48
49
+ def parser_paths_list (supported_devices ):
50
+ paths = supported_devices .split (',' )
51
+ return [Path (p ) for p in paths if Path (p ).is_file ()]
52
+
53
+
49
54
def parse_args ():
50
55
parser = argparse .ArgumentParser (
51
56
formatter_class = argparse .RawDescriptionHelpFormatter , description = __doc__ )
@@ -63,8 +68,8 @@ def parse_args():
63
68
help = 'list of devices to test' )
64
69
parser .add_argument ('--report-file' , type = Path ,
65
70
help = 'path to report file' )
66
- parser .add_argument ('--suppressed -devices' , type = Path , required = False ,
67
- help = 'path to file with suppressed devices for each model' )
71
+ parser .add_argument ('--supported -devices' , type = parser_paths_list , required = False ,
72
+ help = 'paths to Markdown files with supported devices for each model' )
68
73
parser .add_argument ('--precisions' , type = str , nargs = '+' , default = ['FP16' ],
69
74
help = 'IR precisions for all models. By default, models are tested in FP16 precision' )
70
75
parser .add_argument ('--models-dir' , type = Path , required = False , metavar = 'DIR' ,
@@ -141,16 +146,27 @@ def prepare_models(auto_tools_dir, downloader_cache_dir, mo_path, global_temp_di
141
146
return dl_dir
142
147
143
148
144
- def parse_suppressed_device_list ( path ):
145
- if not path :
149
+ def parse_supported_device_list ( paths ):
150
+ if not paths :
146
151
return None
147
152
suppressed_devices = {}
148
- with open (path , "r" ) as f :
149
- for line in f :
150
- if line .startswith ('#' ):
151
- continue
152
- parsed = line .rstrip ('\n ' ).split (sep = ',' )
153
- suppressed_devices [parsed [0 ]] = parsed [1 :]
153
+ for path in paths :
154
+ with Path (path ).open () as f :
155
+ data = f .read ()
156
+ rest = '|' + data .split ('|' , 1 )[1 ]
157
+ table = rest .rsplit ('|' , 1 )[0 ] + '|'
158
+ result = {}
159
+
160
+ for n , line in enumerate (table .split ('\n ' )):
161
+ if n == 0 :
162
+ devices = [t .strip () for t in line .split ('|' )[2 :- 1 ]]
163
+ else :
164
+ values = [t .strip () for t in line .split ('|' )[1 :- 1 ]]
165
+ model_name , values = values [0 ], values [1 :]
166
+ for device , value in zip (devices , values ):
167
+ if not value :
168
+ result [model_name ] = result .get (model_name , []) + [device ]
169
+ suppressed_devices .update (result )
154
170
return suppressed_devices
155
171
156
172
@@ -166,7 +182,7 @@ def get_models(case, keys):
166
182
def main ():
167
183
args = parse_args ()
168
184
169
- suppressed_devices = parse_suppressed_device_list (args .suppressed_devices )
185
+ suppressed_devices = parse_supported_device_list (args .supported_devices )
170
186
171
187
omz_dir = (Path (__file__ ).parent / '../..' ).resolve ()
172
188
demos_dir = omz_dir / 'demos'
0 commit comments