File size: 1,695 Bytes
5b7b13a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
from typing import List
import numpy as np
try:
import tinyBenchmarks as tb
except ModuleNotFoundError:
raise ModuleNotFoundError(
"`tinyBenchmarks` is required for tinyBenchmarks task metric calculation, install via \
`pip install git+https://github.com/felipemaiapolo/tinyBenchmarks`"
)
def agg_pirt(items: List[float], benchmark: str) -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["pirt"]
def agg_gpirt_arc(items: List[float], benchmark: str = "arc") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
def agg_gpirt_gsm8k(items: List[float], benchmark: str = "gsm8k") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
def agg_gpirt_hellaswag(items: List[float], benchmark: str = "hellaswag") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
def agg_gpirt_mmlu(items: List[float], benchmark: str = "mmlu") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
def agg_gpirt_truthfulqa(items: List[float], benchmark: str = "truthfulqa") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
def agg_gpirt_winogrande(items: List[float], benchmark: str = "winogrande") -> float:
items = np.array(items)
predictions = tb.evaluate(items, benchmark)
return predictions[benchmark]["gpirt"]
|