From cba37e8928bb2f1ec67ed190cf7f642fa9ff72a5 Mon Sep 17 00:00:00 2001 From: akiyuki ishikawa Date: Mon, 9 Jan 2023 18:27:37 +0900 Subject: [PATCH 1/2] Add tools/misc/print_config.py --- tools/misc/print_config.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tools/misc/print_config.py diff --git a/tools/misc/print_config.py b/tools/misc/print_config.py new file mode 100644 index 0000000000..520787ea84 --- /dev/null +++ b/tools/misc/print_config.py @@ -0,0 +1,35 @@ +# Copyright (c) OpenMMLab. All rights reserved. +import argparse + +from mmengine import Config, DictAction + + +def parse_args(): + parser = argparse.ArgumentParser(description='Print the whole config') + parser.add_argument('config', help='config file path') + parser.add_argument( + '--cfg-options', + nargs='+', + action=DictAction, + help='override some settings in the used config, the key-value pair ' + 'in xxx=yyy format will be merged into config file. If the value to ' + 'be overwritten is a list, it should be like key="[a,b]" or key=a,b ' + 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" ' + 'Note that the quotation marks are necessary and that no white space ' + 'is allowed.') + args = parser.parse_args() + + return args + + +def main(): + args = parse_args() + + cfg = Config.fromfile(args.config) + if args.cfg_options is not None: + cfg.merge_from_dict(args.cfg_options) + print(f'Config:\n{cfg.pretty_text}') + + +if __name__ == '__main__': + main() From b86f7334fe1f8da2536e0fb7b292aafc2f46f760 Mon Sep 17 00:00:00 2001 From: akiyuki ishikawa Date: Fri, 13 Jan 2023 18:29:52 +0900 Subject: [PATCH 2/2] Change print_config.py location --- tools/{misc => analysis_tools}/print_config.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tools/{misc => analysis_tools}/print_config.py (100%) diff --git a/tools/misc/print_config.py b/tools/analysis_tools/print_config.py similarity index 100% rename from tools/misc/print_config.py rename to tools/analysis_tools/print_config.py