CLUE
CLUE copied to clipboard
[Bugfix] Wrong behavior "loading from config" in train.py
While experimenting via configuration files, I found a bug.
The code couldn't properly set the arguments as the configuration file intends.
Starting from L177 in train.py, the code should be fixed as below.
if args_cmd.load_from_cfg:
args_cfg = dict(OmegaConf.load(args_cmd.cfg_file))
args_cmd = vars(args_cmd)
# Fixed as below from for k in args_cmd.keys()
for k in args_cfg.keys():
# Fixed as below from if args_cmd[k] is not None: args_cfg[k] = args_cmd[k]
if args_cfg[k] is not None: args_cmd[k] = args_cfg[k]
# Fixed as below from args = OmegaConf.create(args_cfg)
args = OmegaConf.create(args_cmd)
Let me know if I got it wrong.