Import upstream Verifiers episodes into Bench
This commit is contained in:
+48
-2
@@ -12,11 +12,12 @@ from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
from . import tasks as task_catalog
|
||||
from .compare import compare as compare_runs, direction
|
||||
from .sweep import analyse, point_from_run
|
||||
from .compare import compare as compare_runs
|
||||
from .compare import direction
|
||||
from .registry import load_registry
|
||||
from .results import RESULTS_DIR, Run
|
||||
from .run import build_run, run_perf, run_quality
|
||||
from .sweep import analyse, point_from_run
|
||||
|
||||
app = typer.Typer(
|
||||
add_completion=False,
|
||||
@@ -307,6 +308,51 @@ def card_cmd(path: Path) -> None:
|
||||
_print_card_dict(data)
|
||||
|
||||
|
||||
@app.command("import-verifiers")
|
||||
def import_verifiers_cmd(
|
||||
target: str = typer.Argument(..., help="registered model/host target that produced the traces"),
|
||||
path: Path = typer.Argument(..., help="Verifiers run directory or traces.jsonl"),
|
||||
task: str = typer.Option(..., help="Bench task name for this imported environment"),
|
||||
tier: str = typer.Option("signal", help="reference | signal | canary"),
|
||||
pass_threshold: float = typer.Option(1.0, help="score required for an episode to pass"),
|
||||
primary_metric: str | None = typer.Option(
|
||||
None, help="trace metric to import; defaults to summed weighted rewards"
|
||||
),
|
||||
save: bool = typer.Option(True, help="write the existing results/*.json scorecard"),
|
||||
) -> None:
|
||||
"""Import upstream Verifiers episodes; execute no model and no harness."""
|
||||
from .verifiers_import import FORMAT, VerifiersImportError, import_quality, source_sha256
|
||||
|
||||
registry = load_registry()
|
||||
registered = registry.target(target)
|
||||
try:
|
||||
quality = import_quality(
|
||||
path,
|
||||
task=task,
|
||||
tier=tier,
|
||||
pass_threshold=pass_threshold,
|
||||
primary_metric=primary_metric,
|
||||
)
|
||||
digest = source_sha256(path)
|
||||
except VerifiersImportError as exc:
|
||||
raise typer.BadParameter(str(exc), param_hint="path") from exc
|
||||
|
||||
run = build_run(registry, registered, quality=[quality], perf=None)
|
||||
run.runner["quality_import"] = {
|
||||
"format": FORMAT,
|
||||
"source_sha256": digest,
|
||||
}
|
||||
run.sampling = {
|
||||
"source": "verifiers",
|
||||
"primary_metric": primary_metric,
|
||||
"pass_threshold": pass_threshold,
|
||||
}
|
||||
_print_card(run)
|
||||
if save:
|
||||
saved = run.save()
|
||||
console.print(f"\n[green]saved[/green] {saved.relative_to(Path.cwd())}")
|
||||
|
||||
|
||||
def _print_card(run: Run) -> None:
|
||||
_print_card_dict(run.to_dict())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user