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

Function exp_flex_component

scripts/config_generator.py:250–310  ·  view source on GitHub ↗
(label_amount)

Source from the content-addressed store, hash-verified

248
249
250def exp_flex_component(label_amount):
251 config_file = r'./config/'
252 save_path = r'./saved_models/'
253
254 if not os.path.exists(config_file):
255 os.mkdir(config_file)
256 if not os.path.exists(save_path):
257 os.mkdir(save_path)
258
259 algs = ['uda', 'pseudolabel']
260 datasets = ['cifar10', 'cifar100', 'svhn', 'stl10']
261 # seeds = [1, 11, 111]
262 seeds = [0]
263
264 dist_port = range(11121, 12120, 1)
265 count = 0
266
267 for alg in algs:
268 for dataset in datasets:
269 for seed in seeds:
270 # change the configuration of each dataset
271 if dataset == 'cifar10':
272 net = 'WideResNet'
273 num_classes = 10
274 num_labels = label_amount[0]
275 weight_decay = 5e-4
276 depth = 28
277 widen_factor = 2
278 elif dataset == 'cifar100':
279 net = 'WideResNet'
280 num_classes = 100
281 num_labels = label_amount[1]
282 weight_decay = 1e-3
283 depth = 28
284 widen_factor = 8
285 elif dataset == 'svhn':
286 net = 'WideResNet'
287 num_classes = 10
288 num_labels = label_amount[2]
289 weight_decay = 5e-4
290 depth = 28
291 widen_factor = 2
292 elif dataset == 'stl10':
293 net = 'WideResNetVar'
294 num_classes = 10
295 num_labels = label_amount[3]
296 weight_decay = 5e-4
297 depth = 28
298 widen_factor = 2
299
300 port = dist_port[count]
301 # prepare the configuration file
302 cfg = create_base_config(alg, seed,
303 dataset, net, num_classes, num_labels,
304 port,
305 weight_decay, depth, widen_factor
306 )
307 count += 1

Callers 1

Calls 2

create_base_configFunction · 0.85
create_configurationFunction · 0.85

Tested by

no test coverage detected