Beispiel #1
0
def load_results(experiment_root):
    # load the model (mlp_best.pkl)
    model_file = os.path.join(experiment_root, 'mlp_best.pkl');    
    with log_timing(log, 'loading model from {}'.format(model_file)):  
        model = serial.load(model_file);    

    # load train
    train_yaml_file = os.path.join(experiment_root, 'train.yaml');
    train_yaml = load_yaml_template(train_yaml_file);
    
    # fix dataset path
    localizer = PathLocalizer();
    train_yaml = localizer.localize_yaml(train_yaml);
    
    with log_timing(log, 'loading train from {}'.format(train_yaml_file)):      
        train = load_yaml(train_yaml)[0];
    
    return train, model;
def load_results(experiment_root):
    # load the model (mlp_best.pkl)
    model_file = os.path.join(experiment_root, 'mlp_best.pkl')
    with log_timing(log, 'loading model from {}'.format(model_file)):
        model = serial.load(model_file)

    # load train
    train_yaml_file = os.path.join(experiment_root, 'train.yaml')
    train_yaml = load_yaml_template(train_yaml_file)

    # fix dataset path
    localizer = PathLocalizer()
    train_yaml = localizer.localize_yaml(train_yaml)

    with log_timing(log, 'loading train from {}'.format(train_yaml_file)):
        train = load_yaml(train_yaml)[0]

    return train, model
Beispiel #3
0
                        default='train.yaml',
                        help='path of the YAML file to run')

    parser.add_argument(
        "-c",
        "--config",  #type=str,
        help="specify a config file")

    parser.add_argument(
        "-l",
        "--localizer",  #type=str,                        
        help="specify a custom localizer")

    args = parser.parse_args()

    train_yaml = load_yaml_template(args.yaml)

    # load optional settings
    if args.config is not None:
        config = load_config_file(args.config)
    else:
        config = empty_config()

    if not hasattr(config, 'random_seed'):
        random_seed = random.randint(0, 100)
        config.random_seed = random_seed
        log.debug('using random seed {}'.format(random_seed))

    # load optional localizer
    if args.localizer is not None:
        localizer_class = args.localizer
Beispiel #4
0
 # parse arguments using optparse or argparse or what have you
 parser = argparse.ArgumentParser(prog='run_train', 
                                  description='run a train algorithm as specified by a YAML file');
                                  
 # global options
 parser.add_argument('yaml', default='train.yaml', help='path of the YAML file to run');
 
 parser.add_argument("-c", "--config", #type=str,
                     help="specify a config file");
                 
 parser.add_argument("-l", "--localizer", #type=str,                        
                     help="specify a custom localizer");
                 
 args = parser.parse_args();
 
 train_yaml = load_yaml_template(args.yaml);
 
 # load optional settings
 if args.config is not None:
     config = load_config_file(args.config);
 else:
     config = empty_config();
     
 if not hasattr(config, 'random_seed'):
     random_seed = random.randint(0, 100);
     config.random_seed = random_seed;
     log.debug('using random seed {}'.format(random_seed))
 
 # load optional localizer
 if args.localizer is not None:
     localizer_class = args.localizer;