22import sys
33import subprocess
44from logger import configure_logger
5- import traceback
65from pathlib import Path
76
87sys .path .append (str (Path (__file__ ).parents [3 ]))
@@ -18,7 +17,7 @@ def __init__(self, filepath):
1817
1918 def parse (self ):
2019 if not self .filepath .exists ():
21- raise FileNotFoundError ('File doesn \' t exist .' )
20+ raise FileNotFoundError ('File not found .' )
2221 log .info (f'Parsing file: { self .filepath .as_posix ()} ' )
2322 with self .filepath .open () as file :
2423 self .lines = file .read ().splitlines ()
@@ -42,18 +41,18 @@ def __init__(self, models_dir, conda, output_dir, vm, branch):
4241 self .output_dir = output_dir
4342 else :
4443 self .output_dir = models_dir
45- self ._command_line = f ''
44+ self ._command_line = ''
4645
4746 def _add_argument (self , name_of_arg , value_of_arg ):
4847 if value_of_arg != '' :
4948 self ._command_line += f' { name_of_arg } { value_of_arg } '
5049
5150 def _add_option (self , name_of_arg ):
52- self ._command_line += f' { name_of_arg } '
51+ self ._command_line += f' { name_of_arg } '
5352
5453 def create_command_line (self , model_name , target , batch , opt_level ):
5554 self ._command_line = (f'{ self .conda } /envs/tvm_main_{ self .branch } /bin/python3 ' + f'{ self .converter } ' )
56- self ._add_argument ('--mod' , f'{ self .models_dir } /{ model_name } /batch_{ batch } /{ model_name } .json' )
55+ self ._add_argument ('--mod' , f'{ self .models_dir } /{ model_name } /batch_{ batch } /{ model_name } .json' )
5756 self ._add_argument ('--params' , f'{ self .models_dir } /{ model_name } /batch_{ batch } /{ model_name } .params' )
5857 self ._add_argument ('-t' , f'"{ target } "' )
5958 self ._add_argument ('--opt_level' , f'{ opt_level } ' )
@@ -69,7 +68,6 @@ def execute(self):
6968 self ._command_line = ''
7069
7170
72-
7371def cli_arguments_parse ():
7472 parser = argparse .ArgumentParser ()
7573
@@ -128,12 +126,10 @@ def main():
128126 for level in args .opt_levels :
129127 proc .create_command_line (
130128 model_name , args .target ,
131- batch , level
129+ batch , level ,
132130 )
133131 proc .execute ()
134132
135133
136-
137-
138- if __name__ == '__main__' :
139- sys .exit (main () or 0 )
134+ if __name__ == '__main__' :
135+ sys .exit (main () or 0 )
0 commit comments