diff --git a/torchtitan/config_manager.py b/torchtitan/config_manager.py index 6c9e07fc..b92d00a4 100644 --- a/torchtitan/config_manager.py +++ b/torchtitan/config_manager.py @@ -52,6 +52,7 @@ class JobConfig: """ def __init__(self): + self.args_dict = None # main parser self.parser = argparse.ArgumentParser(description="torchtitan arg parser.") @@ -610,6 +611,9 @@ def __init__(self): action="store_true", ) + def to_dict(self): + return self.args_dict + def parse_args(self, args_list: list = sys.argv[1:]): args, cmd_args = self.parse_args_from_command_line(args_list) config_file = getattr(args, "job.config_file", None) @@ -647,6 +651,8 @@ def parse_args(self, args_list: list = sys.argv[1:]): for k, v in section_args.items(): args_dict[section][k] = v + self.args_dict = args_dict + for k, v in args_dict.items(): class_type = type(k.title(), (), v) setattr(self, k, class_type())