예제 #1
0
파일: tuners.py 프로젝트: yinfupai/nni
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
예제 #2
0
def get_registered_algo_config_path():
    return str(get_config_file('registered_algorithms.yml'))
예제 #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)
예제 #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]
예제 #5
0
def _save(config):
    json.dump(config, get_config_file('training_services.json').open('w'), indent=4)
예제 #6
0
def _load():
    return json.load(get_config_file('training_services.json').open())