MCPcopy Create free account
hub / github.com/THUDM/GLM / qa_evaluate

Function qa_evaluate

tasks/superglue/evaluate.py:63–72  ·  view source on GitHub ↗
(predictions, labels, examples: List[InputExample], metric)

Source from the content-addressed store, hash-verified

61
62
63def qa_evaluate(predictions, labels, examples: List[InputExample], metric):
64 assert len(examples) == len(predictions)
65 score = 0.0
66 for example, prediction in zip(examples, predictions):
67 ground_truths = example.meta["answers"]
68 prediction = example.meta["candidates"][prediction]
69 if ground_truths:
70 score += metric_max_over_ground_truths(metric, prediction, ground_truths)
71 score = 100.0 * score / len(predictions)
72 return score
73
74
75def squad_evaluate(predictions, labels, examples, metric):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected