def test_arguments_simple(datafiles): filenames = [str(f) for f in datafiles.listdir()] parser = ConfigArgumentParser(filename=filenames[0]) args = parser.parse_args(args=['-c', filenames[0]]) assert args.foo == 'test' assert args.bar == 1234 assert Config.get_instance()['foo'] == 'test' assert Config.get_instance()['bar'] == 1234 Config.clear() parser = ConfigArgumentParser(filename=filenames[0]) args = parser.parse_args(args=['-c', filenames[0], '--foo', 'value']) assert args.foo == 'value' assert args.bar == 1234 assert Config.get_instance()['foo'] == 'value' assert Config.get_instance()['bar'] == 1234 Config.clear() parser = ConfigArgumentParser(filename=filenames[0]) args = parser.parse_args( args=['-c', filenames[0], '--foo', 'value', '--bar', '4321']) assert args.foo == 'value' assert args.bar == 4321 assert Config.get_instance()['foo'] == 'value' assert Config.get_instance()['bar'] == 4321 Config.clear() parser = ConfigArgumentParser(filename=filenames[0]) parser.add_argument('--baz', type=float, default=0.1) args = parser.parse_args( args=['-c', filenames[0], '--foo', 'value', '--bar', '4321']) assert args.foo == 'value' assert args.bar == 4321 assert args.baz == 0.1 assert Config.get_instance()['foo'] == 'value' assert Config.get_instance()['bar'] == 4321 assert Config.get_instance()['baz'] == 0.1 Config.clear()
'feature': feats, 'labels': ys, 'f1_scores': f1s, 'stats': stats } if __name__ == '__main__': parser = ConfigArgumentParser(conflict_handler='resolve') parser.add_argument('--load', type=bool, default=False) parser.add_argument('--name', type=str, default='test') parser.add_argument('--eval', type=bool, default=False) parser.add_argument('--extdata', type=int, default=1) # parser.add_argument('--dump', type=str, default=None, help='config dump filepath') parsed_args = parser.parse_args() print(C.get_instance()) writer = SummaryWriter('asset/log2/%s' % C.get()['name']) _, _, _, ids_test = get_dataset() d_train, d_valid, d_cvalid, d_tests = get_dataloaders( tests_aug=C.get()['eval']) models = { 'resnet34': Resnet34, 'resnet50': Resnet50, 'resnet101': Resnet101, 'resnet152': Resnet152, 'inception_v3': InceptionV3, 'inception_v4': InceptionV4, 'vgg16': Vgg16,