mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-31 03:12:16 +00:00
Trace-driven learning pipeline: - TrainingDataMiner: extract SFT/routing/agent pairs from traces - LoRATrainer: fine-tune local models from trace-derived data - AgentConfigEvolver: rewrite agent configs from trace analysis - LearningOrchestrator: coordinate mine→train→evolve cycle, wired into SystemBuilder Eval framework (15 real IPW benchmarks): - Datasets: SuperGPQA, GPQA, MMLU-Pro, MATH-500, Natural Reasoning, HLE, SimpleQA, WildChat, IPW, GAIA, FRAMES, SWE-bench, SWEfficiency, TerminalBench, TerminalBench Native - Scorers: MCQ extraction, LLM-judge, exact match, structural validation - CLI: jarvis eval list|run|compare|report Composable abstractions: - Recipe system: TOML composition of all 5 pillars (3 built-in recipes) - Agent templates: 15 pre-configured TOML manifests with system prompts - Bundled skills: 20 ready-to-use TOML skill manifests - Operator recipes: researcher (4h), correspondent (5min), sentinel (2h) 102 files changed, ~11,500 lines added. 3241 tests pass (44 skipped). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
112 lines
3.1 KiB
Python
112 lines
3.1 KiB
Python
"""MMLU-Pro dataset provider (TIGER-Lab/MMLU-Pro).
|
|
|
|
Adapted from IPW's mmlu_pro.py dataset loader.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import random
|
|
from typing import Iterable, List, MutableMapping, Optional, Sequence
|
|
|
|
from evals.core.dataset import DatasetProvider
|
|
from evals.core.types import EvalRecord
|
|
|
|
|
|
def _format_options(options: Iterable[str]) -> str:
|
|
rendered = []
|
|
for idx, option in enumerate(options):
|
|
letter = chr(ord("A") + idx)
|
|
rendered.append(f"{letter}. {option}")
|
|
return "\n".join(rendered)
|
|
|
|
|
|
class MMLUProDataset(DatasetProvider):
|
|
"""MMLU-Pro multiple-choice benchmark dataset."""
|
|
|
|
dataset_id = "mmlu-pro"
|
|
dataset_name = "MMLU-Pro"
|
|
|
|
_hf_path = "TIGER-Lab/MMLU-Pro"
|
|
_default_split = "test"
|
|
|
|
def __init__(self) -> None:
|
|
self._records: List[EvalRecord] = []
|
|
|
|
def load(
|
|
self,
|
|
*,
|
|
max_samples: Optional[int] = None,
|
|
split: Optional[str] = None,
|
|
seed: Optional[int] = None,
|
|
) -> None:
|
|
from datasets import load_dataset
|
|
|
|
use_split = split or self._default_split
|
|
dataset = load_dataset(self._hf_path, split=use_split)
|
|
|
|
rows: Sequence[MutableMapping[str, object]]
|
|
if hasattr(dataset, "to_list"):
|
|
rows = dataset.to_list()
|
|
else:
|
|
rows = list(dataset)
|
|
|
|
if seed is not None:
|
|
rng = random.Random(seed)
|
|
rows = list(rows)
|
|
rng.shuffle(rows)
|
|
|
|
if max_samples is not None:
|
|
rows = rows[:max_samples]
|
|
|
|
self._records = []
|
|
for idx, raw in enumerate(rows):
|
|
record = self._convert_row(raw, idx)
|
|
if record is not None:
|
|
self._records.append(record)
|
|
|
|
def iter_records(self) -> Iterable[EvalRecord]:
|
|
return iter(self._records)
|
|
|
|
def size(self) -> int:
|
|
return len(self._records)
|
|
|
|
def _convert_row(
|
|
self, raw: MutableMapping[str, object], idx: int,
|
|
) -> Optional[EvalRecord]:
|
|
question = str(raw.get("question") or "").strip()
|
|
options_raw = raw.get("options") or []
|
|
options = [str(o).strip() for o in options_raw if str(o).strip()]
|
|
answer_letter = str(raw.get("answer") or "").strip().upper()
|
|
|
|
subject = str(raw.get("category") or "general").strip() or "general"
|
|
|
|
if not question or not options or not answer_letter:
|
|
return None
|
|
|
|
prompt_parts = [
|
|
question, "",
|
|
"Options:",
|
|
_format_options(options), "",
|
|
"Respond with the correct letter.",
|
|
]
|
|
problem = "\n".join(part for part in prompt_parts if part).strip()
|
|
|
|
metadata = {
|
|
"question_id": raw.get("question_id"),
|
|
"answer_index": raw.get("answer_index"),
|
|
"src": raw.get("src"),
|
|
"options": options,
|
|
}
|
|
|
|
return EvalRecord(
|
|
record_id=f"mmlu-pro-{idx}",
|
|
problem=problem,
|
|
reference=answer_letter,
|
|
category="reasoning",
|
|
subject=subject,
|
|
metadata=metadata,
|
|
)
|
|
|
|
|
|
__all__ = ["MMLUProDataset"]
|