Datasets:
Download scoring/cases.py from cocolabs/vybbench: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/datasets/cocolabs/vybbench/resolve/main/scoring/cases.py
- Command line
-
hf download hf://datasets/cocolabs/vybbench/scoring/cases.py
-
curl -L -o cases.py https://huggingface.co/datasets/cocolabs/vybbench/resolve/main/scoring/cases.py
1.8 kB
| """Case loaders for the released benchmark data. | |
| Each loader reads one file under ``data/`` so a case list is identical across | |
| runs and across re-scoring: 145 fonts (one pinned word each), 100 colors, and | |
| 200 single-instruction edits. | |
| """ | |
| from __future__ import annotations | |
| import json | |
| from dataclasses import dataclass | |
| from pathlib import Path | |
| DATA_DIR = Path(__file__).resolve().parents[1] / "data" | |
| class FontCase: | |
| """One Google font and one word to render. The ground truth ships as a | |
| rendered image under ``references/``; ``noise_floor`` is that reference | |
| scored against itself rendered at another size and position.""" | |
| family: str | |
| word: str | |
| noise_floor: float | |
| variant: str = "Regular" | |
| def case_id(self) -> str: | |
| return f"{self.family}/{self.word}" | |
| class ColorCase: | |
| hex: str | |
| def case_id(self) -> str: | |
| return self.hex.lstrip("#").lower() | |
| class EditCase: | |
| """One design and the single edit asked of it. ``start_png``/``start_svg`` | |
| name the shared starting design under ``starts/``; every arm edits that | |
| same design.""" | |
| design_id: str | |
| width: int | |
| height: int | |
| category: str | |
| instruction: str | |
| start_svg: str | |
| start_png: str | |
| def _read_jsonl(name: str) -> list[dict]: | |
| path = DATA_DIR / name | |
| return [json.loads(line) for line in path.read_text().splitlines() if line] | |
| def font_cases() -> list[FontCase]: | |
| return [FontCase(**row) for row in _read_jsonl("fonts.jsonl")] | |
| def color_cases() -> list[ColorCase]: | |
| return [ColorCase(**row) for row in _read_jsonl("colors.jsonl")] | |
| def edit_cases() -> list[EditCase]: | |
| return [EditCase(**row) for row in _read_jsonl("edits.jsonl")] | |