Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated condition in metadata depersonalize function #5655

Merged
merged 7 commits into from
May 21, 2021
9 changes: 6 additions & 3 deletions model-optimizer/mo/utils/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,12 +1234,15 @@ def check_positive(value):
return int_value


def depersonalize(value: str):
def depersonalize(value: str, key: str):
dir_keys = [
'output_dir', 'extensions', 'saved_model_dir', 'tensorboard_logdir', 'caffe_parser_path'
]
rkazants marked this conversation as resolved.
Show resolved Hide resolved
if not isinstance(value, str):
return value
res = []
for path in value.split(','):
if os.path.isdir(path):
if os.path.isdir(path) and key in dir_keys:
res.append('DIR')
elif os.path.isfile(path):
res.append(os.path.join('DIR', os.path.split(path)[1]))
Expand All @@ -1252,7 +1255,7 @@ def get_meta_info(argv: argparse.Namespace):
meta_data = {'unset': []}
for key, value in argv.__dict__.items():
if value is not None:
value = depersonalize(value)
value = depersonalize(value, key)
meta_data[key] = value
else:
meta_data['unset'].append(key)
Expand Down