コード例 #1
0
def evaluate_main_modified(dataset):
    args, train_args = _parse_args_modified(dataset)
    print("train_args:\n", train_args)
    # TODO do this argument transfering in the load_train_args instead of train.py, evaluate.py, ensemble_evaluate.py
    train_args.checkpoint_model_num = args.checkpoint_model_num
    train_args.entity_extension = args.entity_extension
    train.args = args
    args.batch_size = train_args.batch_size
    printPredictions = None
    if args.print_predictions:
        from evaluation.print_predictions import PrintPredictions
        printPredictions = PrintPredictions(
            config.base_folder + "data/tfrecords/" + args.experiment_name +
            "/", args.predictions_folder, args.entity_extension,
            args.gm_bucketing_pempos, args.print_global_voters,
            args.print_global_pairwise_scores)

    return printPredictions
コード例 #2
0
        '_z_') if args.el_datasets != "" else None
    args.ed_val_datasets = [int(x) for x in args.ed_val_datasets.split('_')]
    args.el_val_datasets = [int(x) for x in args.el_val_datasets.split('_')]
    args.gm_bucketing_pempos = [
        int(x) for x in args.gm_bucketing_pempos.split('_')
    ] if args.gm_bucketing_pempos else []

    print(args)
    return args, train_args


if __name__ == "__main__":
    args, train_args = _parse_args()
    # TODO do this argument transfering in the load_train_args instead of train.py, evaluate.py, ensemble_evaluate.py
    train_args.checkpoint_model_num = args.checkpoint_model_num
    train_args.entity_extension = args.entity_extension
    train.args = args
    args.batch_size = train_args.batch_size
    printPredictions = None
    if args.print_predictions:
        from evaluation.print_predictions import PrintPredictions
        printPredictions = PrintPredictions(
            config.base_folder + "data/tfrecords/" + args.experiment_name +
            "/", args.predictions_folder, args.entity_extension,
            args.gm_bucketing_pempos, args.print_global_voters,
            args.print_global_pairwise_scores)
    from model.util import Tee
    tee = Tee(args.output_folder + 'evaluate-log.txt', 'a')
    print("train_args:\n", train_args)
    evaluate()
コード例 #3
0
            args.predictions_folder):
        os.makedirs(args.predictions_folder)
    if args.predictions_folder is not None and not os.path.exists(
            args.predictions_folder + "ed/"):
        os.makedirs(args.predictions_folder + "ed/")
    if args.predictions_folder is not None and not os.path.exists(
            args.predictions_folder + "el/"):
        os.makedirs(args.predictions_folder + "el/")

    args.output_folder = []
    for training_name, prefix in zip(args.training_name,
                                     args.all_spans_training):
        args.output_folder.append(config.base_folder+"data/tfrecords/" + \
                             args.experiment_name+"/{}training_folder/".format(prefix) + \
                             training_name+"/")

    args.batch_size = 1
    print(args)
    return args


if __name__ == "__main__":
    args = _parse_args()
    printPredictions = None
    if args.predictions_folder is not None:
        from evaluation.print_predictions import PrintPredictions
        printPredictions = PrintPredictions(
            config.base_folder + "data/tfrecords/" + args.experiment_name +
            "/", args.predictions_folder)
    evaluate()