Ejemplo n.º 1
0
def evaluate(args, model, tokenizer, prefix="", val_or_test="val"):
    examples, predictions = predict(args,
                                    model,
                                    tokenizer,
                                    prefix=prefix,
                                    val_or_test=val_or_test)
    # Compute the F1 and exact scores.
    results, has_ans_eval, no_ans_eval = squad_evaluate(examples, predictions)
    return results, has_ans_eval, no_ans_eval
Ejemplo n.º 2
0
def evaluate(args, model, tokenizer, prefix="", val_or_test="val"):
    # prefix = epoch
    examples, predictions, probabilites = predict(args,
                                                  model,
                                                  tokenizer,
                                                  prefix=prefix,
                                                  val_or_test=val_or_test)
    # Compute the F1 and exact scores.
    # predictions
    results = squad_evaluate(examples,
                             predictions,
                             no_answer_probs=probabilites)
    return results