示例#1
0
    def build_tmp_config_file(self):
        base_config = load_yaml(self.config_file)

        # Split ablation opts
        params_list = parse_opts(self.opts)
        config_list = []
        for params in params_list:
            config = {**base_config, **self.fixed_opts, **params}
            config_list.append(config)
        # import ipdb; ipdb.set_trace()
        return config_list, params_list
示例#2
0
    def build_tmp_config_file(self):
        base_config = load_yaml(self.config_file)
        print(self.opts)

        # Split ablation opts
        config_list = []
        for i in range(self.count_total):
            opt = copy.deepcopy(self.opts)
            one_opt = _config_parsing(opt, i)
            config = {**base_config, **one_opt}
            config_list.append(config)
        # print("debug build_tmp_config_file: ", config_list)
        return config_list
    if type(config) is dict or type(config) is OrderedDict:
        pop_key_list = []
        for key, value in config.items():
            # print("debug: ", key, value)
            if value is None or value == "" or value == "None":
                # print("debug: poped", key, value)
                pop_key_list.append(key)
            elif type(value) is dict or type(config) is OrderedDict:
                _clear_config(value)
            else:
                pass
        for key in pop_key_list:
            config.pop(key)
    return config


if __name__ == '__main__':
    # args = trans_args()
    # logger, config = trans_init(args)
    logger, config = trans_configure()
    runs_dir = config['runs_dir']
    file_path = os.path.abspath(__file__)
    shutil.copy(file_path, os.path.join(runs_dir, __file__))

    print(file_path)
    print(__file__)

    conf = load_yaml("tmp.yml")
    print(conf)
    cc = _clear_config(conf)
    print(cc)