def get_resnet_config(): """Define config of an additional object. In this case 'resnet'""" config = Configuration('resnet') config.add_param('foo', True, 'Test variable') config.add_param('bar', False, 'Another variable') config.add_param('mixed', 555.5, 'Yet another variable') config.add_param('maybe_alist_of_float', 1., 'some potential list', 'maybe_list') return config
def get_subconfig(net_type): """ Define configuration for an object. In this case a network names 'retina' """ if not (net_type == 'retina'): raise RuntimeError(f"Unsupported network type {net_type}") # default retina configuration config = Configuration('retina') config.add_param('setting', 111, 'some standard setting') config.add_param('maybe_alist_of_int', 0, 'some potential list', 'maybe_list') config.add_param('empty_list', [], 'some empty list', 'maybe_list') # nested configuration for resnet config.add_param('resnet', get_resnet_config(), 'resnet help') return config
def get_basic_config(): """ Define some default basic configuration """ # global configuration config = Configuration() config.add_param('aint', 1, 'Some int') config.add_param('astr', 'a', 'Some string') config.add_param('afloat', 10.1, 'Some float') config.add_param('alist', ['a', 2, 4.3], 'Some list') config.add_param('adict', {'a': 1}, 'Some dict') config.add_param('training.network_type', 'dope', 'Network type') config.add_param('optimizer.learning_rate', 1.000, 'Learning Rate') config.a = '123' return config