MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / create_configuration

Function create_configuration

scripts/config_generator.py:7–27  ·  view source on GitHub ↗
(cfg, cfg_file)

Source from the content-addressed store, hash-verified

5
6
7def create_configuration(cfg, cfg_file):
8 cfg['save_name'] = "{alg}_{dataset}_{num_lb}_{seed}".format(
9 alg=cfg['alg'],
10 dataset=cfg['dataset'],
11 num_lb=cfg['num_labels'],
12 seed=cfg['seed'],
13 )
14
15 alg_file = cfg_file + cfg['alg'] + '/'
16 if not os.path.exists(alg_file):
17 os.mkdir(alg_file)
18
19 print(alg_file + cfg['save_name'] + '.yaml')
20 with open(alg_file + cfg['save_name'] + '.yaml', 'w', encoding='utf-8') as w:
21 lines = []
22 for k, v in cfg.items():
23 line = str(k) + ': ' + str(v)
24 lines.append(line)
25 for line in lines:
26 w.writelines(line)
27 w.write('\n')
28
29
30def create_base_config(alg, seed,

Callers 2

exp_baselineFunction · 0.85
exp_flex_componentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected