(self, doc: dict, results: List[Tuple[float, bool]])
| 1384 | ] |
| 1385 | |
| 1386 | def process_results(self, doc: dict, results: List[Tuple[float, bool]]) -> dict: |
| 1387 | results = [ |
| 1388 | res[0] for res in results |
| 1389 | ] # only retain loglikelihoods, discard is_greedy TODO: do we need is_greedy anywhere? |
| 1390 | gold = doc["gold"] |
| 1391 | |
| 1392 | acc = 1.0 if np.argmax(results) == gold else 0.0 |
| 1393 | completion_len = np.array([float(len(i)) for i in doc["choices"]]) |
| 1394 | acc_norm = 1.0 if np.argmax(results / completion_len) == gold else 0.0 |
| 1395 | |
| 1396 | return { |
| 1397 | "acc": acc, |
| 1398 | "acc_norm": acc_norm, |
| 1399 | } |
| 1400 | |
| 1401 | def higher_is_better(self) -> dict: |
| 1402 | return { |
nothing calls this directly
no outgoing calls
no test coverage detected