Esempio n. 1
0
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
Esempio n. 2
0
def get_registered_algo_config_path():
    return str(get_config_file('registered_algorithms.yml'))
Esempio n. 3
0
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)
Esempio n. 4
0
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]
Esempio n. 5
0
def _save(config):
    json.dump(config, get_config_file('training_services.json').open('w'), indent=4)
Esempio n. 6
0
def _load():
    return json.load(get_config_file('training_services.json').open())