Spaces:
Runtime error
Runtime error
Download src/llm_eval/benchmarks/base.py from bhargob11/llm-eval-framework: direct link, hf CLI and curl.
- Browser
- Download file 865 Bytes
-
https://huggingface.co/spaces/bhargob11/llm-eval-framework/resolve/main/src/llm_eval/benchmarks/base.py
- Command line
-
hf download hf://spaces/bhargob11/llm-eval-framework/src/llm_eval/benchmarks/base.py
-
curl -L -o base.py https://huggingface.co/spaces/bhargob11/llm-eval-framework/resolve/main/src/llm_eval/benchmarks/base.py
865 Bytes
| from __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| from dataclasses import dataclass | |
| from typing import Iterable | |
| class BenchmarkSample: | |
| sample_id: str | |
| question: str | |
| choices: list[str] | |
| answer_index: int | |
| category: str | |
| def prompt(self) -> str: | |
| option_lines = [f"{chr(65 + i)}. {choice}" for i, choice in enumerate(self.choices)] | |
| return "\n".join( | |
| [ | |
| f"Category: {self.category}", | |
| "Answer the following multiple-choice question.", | |
| self.question, | |
| *option_lines, | |
| "Reply with only the option letter (A, B, C, D, ...).", | |
| ] | |
| ) | |
| class BenchmarkDataset(ABC): | |
| name: str | |
| def load(self) -> Iterable[BenchmarkSample]: | |
| raise NotImplementedError | |