CLUE icon indicating copy to clipboard operation
CLUE copied to clipboard

[Bugfix] Wrong behavior "loading from config" in train.py

Open fakedev9999 opened this issue 3 years ago • 0 comments

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.

fakedev9999 avatar Dec 11 '21 13:12 fakedev9999