Exemplo n.º 1
0
        elif param in float_params:
            conf_dict[param] = float(c[param])
        else:
            conf_dict[param] = c[param]
    return conf_dict


parser = argparse.ArgumentParser(description='Run training')
parser.add_argument("--config",
                    type=str,
                    default="./src/df_v1/config/config_heart.conf",
                    help="Path to the config file.")

parser.add_argument("--data.dataset", type=str, default=None)
parser.add_argument("--data.split", type=str, default=None)
parser.add_argument("--data.batch_size", type=int, default=None)
parser.add_argument("--data.episodes", type=int, default=None)
parser.add_argument("--data.cuda", type=int, default=None)
parser.add_argument("--data.gpu", type=int, default=None)

parser.add_argument("--train.patience", type=int, default=None)
parser.add_argument("--train.lr", type=float, default=None)

# Run training
args = vars(parser.parse_args())
config = configparser.ConfigParser()
config.read(args['config'])
filtered_args = dict((k, v) for (k, v) in args.items() if not v is None)
config = preprocess_config({**config['TRAIN'], **filtered_args})
train(config)
Exemplo n.º 2
0
                                                    test_query,
                                                    'data.train_size':
                                                    train_size,
                                                    'data.test_size':
                                                    test_size,
                                                    'data.rotation_range':
                                                    rotation_range,
                                                    'data.width_shift_range':
                                                    width_shift_range,
                                                    'data.height_shift_range':
                                                    height_shift_range,
                                                    'data.horizontal_flip':
                                                    horizontal_flip,
                                                    'model.type': model_type,
                                                    'model.nb_layers':
                                                    nb_layers,
                                                    'model.nb_filters':
                                                    nb_filters,
                                                    'train.lr': lr
                                                }

                                                preprocessed_config = preprocess_config({
                                                    **config_from_file['TRAIN'],
                                                    **custom_params
                                                })
                                                train(preprocessed_config)
                                            except:
                                                print(
                                                    "Error. Probably memory :c"
                                                )