From 8af831ae3cfa0eb48647624072a887083412b12a Mon Sep 17 00:00:00 2001 From: iclementine Date: Fri, 20 Nov 2020 15:06:07 +0800 Subject: [PATCH] add --config by default when adding config options to a parser --- parakeet/utils/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parakeet/utils/conf.py b/parakeet/utils/conf.py index fd41334..d658869 100644 --- a/parakeet/utils/conf.py +++ b/parakeet/utils/conf.py @@ -25,6 +25,7 @@ class Config(attrdict.AttrDict): def merge_args(self, args): args_dict = vars(args) + args_dict.pop("config") # exclude config file path nested_dict = flatdict.FlatDict(args_dict, delimiter=".").as_dict() self.update(nested_dict) @@ -36,6 +37,9 @@ class Config(attrdict.AttrDict): return flat def add_options_to_parser(self, parser): + parser.add_argument( + "--config", type=str, + help="extra config file to override the default config") flat = self.flatten() g = parser.add_argument_group("config file options") for k, v in flat.items():