virajprabhu / CLUE

PyTorch code for Active Domain Adaptation via Clustering Uncertainty-weighted Embeddings (ICCV 2021)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

TomTaehoonKim opened this issue · 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.

You're right, thanks for the fix!