def get_tuner_class_dict(): config_file = str(get_config_file('registered_algorithms.yml')) if os.path.exists(config_file): with open(config_file, 'r') as f: config = yaml.safe_load(f) else: config = {} ret = {} for t in ['tuners', 'advisors']: for entry in config[t]: ret[entry['builtinName']] = entry['className'] return ret
def get_registered_algo_config_path(): return str(get_config_file('registered_algorithms.yml'))
def _save_custom_config(custom_algos): config = defaultdict(list) for algo in custom_algos: config[algo.algo_type + 's'].append(algo.dump()) text = yaml.dump(dict(config), default_flow_style=False) get_config_file('registered_algorithms.yml').write_text(text)
def _load_custom_config(): path = get_config_file('registered_algorithms.yml') # for backward compatibility, NNI v2.5- stores all algorithms in this file return [algo for algo in _load_config_file(path) if not algo.is_builtin]
def _save(config): json.dump(config, get_config_file('training_services.json').open('w'), indent=4)
def _load(): return json.load(get_config_file('training_services.json').open())