File tree 1 file changed +8
-1
lines changed
model-archiver/model_archiver
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 43
43
MANIFEST_FILE_NAME = "MANIFEST.json"
44
44
MAR_INF = "MAR-INF"
45
45
46
+ logger = logging .getLogger (__file__ )
47
+
46
48
47
49
class ModelExportUtils (object ):
48
50
"""
@@ -366,7 +368,12 @@ def check_model_name_regex_or_exit(model_name):
366
368
@staticmethod
367
369
def validate_inputs (model_name , export_path ):
368
370
ModelExportUtils .check_model_name_regex_or_exit (model_name )
369
- if not os .path .isdir (os .path .abspath (export_path )):
371
+ if not os .path .exists (os .path .abspath (export_path )):
372
+ logger .warning (
373
+ f"Export directory ({ export_path } ) does not exist. Creating..."
374
+ )
375
+ os .makedirs (os .path .abspath (export_path ))
376
+ elif not os .path .isdir (os .path .abspath (export_path )):
370
377
raise ModelArchiverError (
371
378
"Given export-path {} is not a directory. "
372
379
"Point to a valid export-path directory." .format (export_path )
You can’t perform that action at this time.
0 commit comments