Datasets:
Download scripts/build_model_chronicle.py from My-Weird-Prompts/Model-Chronicle: direct link, hf CLI and curl.
- Browser
- Download file 17.8 kB
-
https://huggingface.co/datasets/My-Weird-Prompts/Model-Chronicle/resolve/main/scripts/build_model_chronicle.py
- Command line
-
hf download hf://datasets/My-Weird-Prompts/Model-Chronicle/scripts/build_model_chronicle.py
-
curl -L -o build_model_chronicle.py https://huggingface.co/datasets/My-Weird-Prompts/Model-Chronicle/resolve/main/scripts/build_model_chronicle.py
17.8 kB
| #!/usr/bin/env python3 | |
| """ | |
| Build the MWP model chronicle: a few aired scripts per script-writer model (PLAN-040). | |
| Publishes https://huggingface.co/datasets/My-Weird-Prompts/model-chronicle (public) | |
| and writes website/public/data/model-chronicle.json (the same rows minus | |
| `transcript`) for the /benchmark hub. | |
| Selection, per canonical writer model (canonicalisation mirrors | |
| `canonical_model()` in pipeline/scripts/build_transcript_corpus.py, i.e. the | |
| `llm_model_canonical` column of the HF `transcripts` dataset): | |
| * Candidates: aired (`is_test = false`), English, with a transcript, and not a | |
| translation or an `audio_eval` special. Records that name no model are | |
| skipped: manual-script, manual-generation, unknown, none, openrouter/mixed, | |
| null/empty. | |
| * Pool, first non-empty of: pipeline-written with >= 1,500 words; pipeline- | |
| written of any length; offline-written (episode_type = 'manual-script', | |
| i.e. Claude Code via /webhook/generate-from-script) >= 1,500 words; offline | |
| of any length. So offline scripts appear only when a model has nothing else. | |
| * Picks from the pool, ordered by pub_date: earliest, the median-date one | |
| (index (n-1)//2) and the latest; fewer when the pool has fewer than 3. | |
| Deterministic: the same database gives the same picks. | |
| Usage: | |
| .venv/bin/python scripts/build_model_chronicle.py # build + push | |
| .venv/bin/python scripts/build_model_chronicle.py --dry-run # build only, no push | |
| .venv/bin/python scripts/build_model_chronicle.py --out DIR # where the jsonl + card go | |
| Reads POSTGRES_URL and HF_TOKEN from the environment or .env.production (the same | |
| mechanism as pipeline/scripts/sync_hf_dataset.py). Read-only on the database. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import os | |
| import sys | |
| import tempfile | |
| from collections import defaultdict | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent | |
| try: | |
| from dotenv import load_dotenv | |
| load_dotenv(ROOT / ".env.production") | |
| load_dotenv(ROOT / "website" / ".env.local") | |
| except ImportError: | |
| pass | |
| import psycopg2 | |
| import psycopg2.extras | |
| HF_REPO = "My-Weird-Prompts/model-chronicle" | |
| SITE_JSON = ROOT / "website" / "public" / "data" / "model-chronicle.json" | |
| SITE = "https://myweirdprompts.com" | |
| MIN_WORDS = 1500 | |
| # --- canonicalisation: mirror of pipeline/scripts/build_transcript_corpus.py --- | |
| PROVIDER_PREFIXES = { | |
| "deepseek": "deepseek", | |
| "claude": "anthropic", | |
| "gemini": "google", | |
| "gpt": "openai", | |
| "o1": "openai", | |
| "grok": "x-ai", | |
| "glm": "z-ai", | |
| "minimax": "minimax", | |
| "mimo": "xiaomi", | |
| "mercury": "inception", | |
| } | |
| NON_MODEL_VALUES = {"manual-script", "unknown"} | |
| def canonical_model(value: str | None) -> tuple[str, str]: | |
| """'anthropic/claude-sonnet-4.6' -> ('claude-sonnet-4-6', 'anthropic'). Same rule as the corpus.""" | |
| model = (value or "").strip().lower() | |
| if not model or model in NON_MODEL_VALUES: | |
| return model, "" | |
| provider, _, name = model.partition("/") | |
| if not name: | |
| name, provider = provider, "" | |
| for prefix, vendor in PROVIDER_PREFIXES.items(): | |
| if name.startswith(prefix): | |
| provider = vendor | |
| break | |
| return name.replace(".", "-"), provider | |
| # Canonical values that name no writer model (`openrouter/mixed` canonicalises to `mixed`). | |
| SKIP_CANONICAL = {"manual-script", "manual-generation", "unknown", "none", "mixed", ""} | |
| SKIP_EPISODE_TYPES = {"translation", "audio_eval"} | |
| QUERY = """ | |
| SELECT | |
| episode_number, slug, title, pub_date, llm_model, episode_type, language, | |
| prompt_version, pipeline_version, script_word_count, transcript | |
| FROM episodes | |
| WHERE is_test = FALSE | |
| ORDER BY pub_date, episode_number | |
| """ | |
| COLUMNS = [ | |
| ("model_canonical", "Canonical writer id: vendor prefix dropped, `.` folded to `-` (same rule as `llm_model_canonical` in My-Weird-Prompts/transcripts)"), | |
| ("llm_model", "The writer id as recorded on the episode"), | |
| ("provider", "Vendor, from the recorded prefix or the bare name"), | |
| ("display_name", "Human label used on myweirdprompts.com"), | |
| ("era_first", "Date of the model's first aired episode (all of its episodes, not just this pool)"), | |
| ("era_last", "Date of the model's latest aired episode"), | |
| ("model_episode_count", "Aired episodes the model is credited with"), | |
| ("pick", "`earliest`, `middle` (median date within the pool) or `latest`"), | |
| ("pool", "Which pool the pick came from: `pipeline`, `pipeline-short`, `offline` or `offline-short` (short = under 1,500 words)"), | |
| ("episode_number", "Display number at build time; not a stable id (use `slug`)"), | |
| ("slug", "Stable episode id"), | |
| ("title", "Episode title"), | |
| ("pub_date", "Publication date, YYYY-MM-DD (UTC)"), | |
| ("written", "`pipeline` (the production pipeline wrote it) or `offline` (written in Claude Code and submitted as a finished script)"), | |
| ("episode_type", "Pipeline episode type"), | |
| ("prompt_version", "System-prompt template version, where recorded (null before March 2026: not recorded, not none)"), | |
| ("pipeline_version", "Pipeline version string, where recorded"), | |
| ("word_count", "Whitespace-delimited words in the transcript, speaker labels included"), | |
| ("url", "Episode page"), | |
| ("transcript_url", "Plain-text transcript on the site"), | |
| ("transcript", "The aired script, `Speaker: text` per turn"), | |
| ] | |
| def display_names() -> dict[str, str]: | |
| """Canonical id -> label, parsed from website/src/lib/modelNames.ts so the two cannot drift.""" | |
| import re | |
| src = (ROOT / "website" / "src" / "lib" / "modelNames.ts").read_text() | |
| out: dict[str, str] = {} | |
| block = src.split("MODEL_DISPLAY_NAMES", 1)[1].split("};", 1)[0] | |
| for raw, label in re.findall(r"'([^']+)':\s*'([^']+)'", block): | |
| out.setdefault(canonical_model(raw)[0], label) | |
| out["gemini-3-flash-preview"] = "Gemini 3 Flash Preview" # same override as modelNames.ts | |
| return out | |
| def fetch_rows() -> list[dict]: | |
| url = os.environ.get("POSTGRES_URL") | |
| if not url: | |
| sys.exit("POSTGRES_URL not set (.env.production or environment)") | |
| conn = psycopg2.connect(url) | |
| conn.set_session(readonly=True) | |
| try: | |
| with conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cur: | |
| cur.execute(QUERY) | |
| return [dict(r) for r in cur.fetchall()] | |
| finally: | |
| conn.close() | |
| def build(rows: list[dict]) -> tuple[list[dict], dict]: | |
| names = display_names() | |
| era: dict[str, dict] = {} | |
| pools: dict[str, dict[str, list[dict]]] = defaultdict(lambda: defaultdict(list)) | |
| for r in rows: | |
| canon, provider = canonical_model(r["llm_model"]) | |
| day = r["pub_date"].astimezone(timezone.utc).strftime("%Y-%m-%d") if r["pub_date"] else None | |
| e = era.setdefault(canon, {"first": day, "last": day, "count": 0, "provider": provider}) | |
| e["count"] += 1 | |
| if day and (not e["first"] or day < e["first"]): | |
| e["first"] = day | |
| if day and (not e["last"] or day > e["last"]): | |
| e["last"] = day | |
| e["provider"] = e["provider"] or provider | |
| if canon in SKIP_CANONICAL: | |
| continue | |
| if (r["episode_type"] or "") in SKIP_EPISODE_TYPES: | |
| continue | |
| if (r["language"] or "en") != "en": | |
| continue | |
| text = (r["transcript"] or "").strip() | |
| if not text: | |
| continue | |
| words = r["script_word_count"] or len(text.split()) | |
| written = "offline" if r["episode_type"] == "manual-script" else "pipeline" | |
| pool = written if words >= MIN_WORDS else f"{written}-short" | |
| pools[canon][pool].append({**r, "_day": day, "_words": words, "_written": written, "_provider": provider}) | |
| out: list[dict] = [] | |
| summary: dict[str, dict] = {} | |
| for canon in sorted(pools, key=lambda c: (era[c]["first"] or "", c)): | |
| for pool_name in ("pipeline", "pipeline-short", "offline", "offline-short"): | |
| pool = pools[canon].get(pool_name) | |
| if pool: | |
| break | |
| pool.sort(key=lambda x: (x["_day"] or "", x["episode_number"] or 0, x["slug"])) | |
| n = len(pool) | |
| picks: list[tuple[str, dict]] = [("earliest", pool[0])] | |
| if n >= 3: | |
| picks.append(("middle", pool[(n - 1) // 2])) | |
| if n >= 2: | |
| picks.append(("latest", pool[-1])) | |
| e = era[canon] | |
| for label, r in picks: | |
| out.append({ | |
| "model_canonical": canon, | |
| "llm_model": r["llm_model"], | |
| "provider": r["_provider"] or e["provider"], | |
| "display_name": names.get(canon, canon), | |
| "era_first": e["first"], | |
| "era_last": e["last"], | |
| "model_episode_count": e["count"], | |
| "pick": label, | |
| "pool": pool_name, | |
| "episode_number": r["episode_number"], | |
| "slug": r["slug"], | |
| "title": r["title"], | |
| "pub_date": r["_day"], | |
| "written": r["_written"], | |
| "episode_type": r["episode_type"], | |
| "prompt_version": r["prompt_version"], | |
| "pipeline_version": r["pipeline_version"], | |
| "word_count": r["_words"], | |
| "url": f"{SITE}/episode/{r['slug']}", | |
| "transcript_url": f"{SITE}/transcripts/{r['slug']}.txt", | |
| "transcript": (r["transcript"] or "").strip(), | |
| }) | |
| summary[canon] = {"picks": len(picks), "pool": pool_name, "pool_size": n, "episodes": e["count"]} | |
| return out, summary | |
| def card(rows: list[dict], summary: dict, built_at: str) -> str: | |
| models = [] | |
| seen = set() | |
| for r in rows: | |
| if r["model_canonical"] in seen: | |
| continue | |
| seen.add(r["model_canonical"]) | |
| s = summary[r["model_canonical"]] | |
| models.append( | |
| f"| `{r['model_canonical']}` | {r['display_name']} | {r['provider'] or '—'} | {r['era_first']} → {r['era_last']} " | |
| f"| {r['model_episode_count']:,} | {s['picks']} | {s['pool']} |" | |
| ) | |
| cols = "\n".join(f"| `{c}` | {d} |" for c, d in COLUMNS) | |
| n_models = len(models) | |
| n_offline = sum(1 for r in rows if r["written"] == "offline") | |
| return f"""--- | |
| license: cc-by-4.0 | |
| language: | |
| - en | |
| pretty_name: My Weird Prompts — Model Chronicle | |
| tags: | |
| - podcast | |
| - dialogue | |
| - ai-generated | |
| - llm-evaluation | |
| - model-comparison | |
| task_categories: | |
| - text-generation | |
| size_categories: | |
| - n<1K | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: train | |
| path: chronicle.jsonl | |
| --- | |
| # My Weird Prompts — Model Chronicle | |
| *My Weird Prompts* is an AI-generated podcast: every episode's dialogue is written by | |
| a large language model, and the model that writes it has changed many times since | |
| November 2025. The back catalogue is therefore a chronicle of how frontier models | |
| evolved, with each era's writer on air. This dataset is a small, curated slice of it — | |
| **up to three aired scripts per writer model** — so anyone can read eras side by side | |
| ("Gemini 2.5 Flash vs DeepSeek V4 Pro vs GPT-6.1 Sol") without downloading the full | |
| corpus. | |
| {len(rows)} scripts from {n_models} writer models, built {built_at}. | |
| - Site hub, with the leaderboard and writer history: <https://myweirdprompts.com/benchmark> | |
| - Full corpus (every episode, turns, text statistics): [`My-Weird-Prompts/transcripts`](https://huggingface.co/datasets/My-Weird-Prompts/transcripts) | |
| - Browse and filter every transcript by model: [`My-Weird-Prompts/transcripts-explorer`](https://huggingface.co/spaces/My-Weird-Prompts/transcripts-explorer) | |
| - Controlled, same-prompt benchmark of candidate writers: <https://github.com/My-Weird-Prompts/eval> | |
| ## Read this before comparing | |
| **These are not same-prompt comparisons.** Each script answers whatever listener or | |
| host prompt was on the queue that day; topics, lengths and episode formats differ. | |
| For like-for-like scoring of writers on identical briefs, use the eval repo above. | |
| The model is not the only thing that changed between eras: | |
| - **The system-prompt template changed with the model, twice.** In the full | |
| catalogue (measured 2026-09-22 over 5,332 episodes), template 3.5 → 4.0 landed on | |
| the April 2026 Gemini → DeepSeek switch, and 4.0 → 4.1 on the September 2026 | |
| DeepSeek V4 Pro → V4.1 Flash switch. A difference between those eras is never | |
| attributable to the model alone. `prompt_version` is included per row; null | |
| means not recorded (before March 2026), not "none". | |
| - **A deterministic verbal-tic cleanup pass** runs after generation and deletes | |
| stock phrasings (conjunction openers, sycophantic openers, echo handoffs), so | |
| the aired text is not the raw model output. The full corpus counts what it removed | |
| per episode (`tic_*` columns). | |
| - **Episode length moved**: median length rose from about 3,000 words (2025) to | |
| about 4,200 (2026), so length-sensitive measures (n-gram repetition, compression) | |
| trend partly with length. | |
| - **Some eras are a few days long.** The March 2026 and October 2026 bake-offs aired | |
| one to a handful of episodes per candidate; those share that week's prompts, so | |
| anything topic-linked in them is subject matter, not style. `model_episode_count` | |
| shows how much each model actually wrote. | |
| - **Offline scripts** (`written = offline`, {n_offline} rows here) were written in | |
| Claude Code and submitted as finished scripts rather than by the production | |
| pipeline. They are used only for models with no pipeline-written episode. | |
| ## Selection rule | |
| Per canonical writer model, from aired English episodes with a transcript (test | |
| episodes, translations and `audio_eval` specials excluded; records that name no | |
| model — `manual-script`, `manual-generation`, `unknown`, `none`, `openrouter/mixed` | |
| — skipped): | |
| 1. Pool = the first non-empty of: pipeline-written with at least 1,500 words; | |
| pipeline-written of any length; offline-written with at least 1,500 words; | |
| offline-written of any length (the `pool` column says which). | |
| 2. Picks, by publication date within the pool: the **earliest**, the **median-date** | |
| one and the **latest**. A model with one or two eligible episodes gets one or two. | |
| The build is deterministic. It is rebuilt on demand by | |
| [`scripts/build_model_chronicle.py`](scripts/build_model_chronicle.py) (a copy of the | |
| exact code ships in this repo) from the production database; hand edits on the Hub | |
| are overwritten. | |
| ## Models | |
| | Canonical id | Name | Provider | Era (first → last aired) | Episodes | Picks | Pool | | |
| |---|---|---|---|---|---|---| | |
| {chr(10).join(models)} | |
| ## Columns | |
| | Column | Description | | |
| |---|---| | |
| {cols} | |
| Canonicalisation: `anthropic/claude-sonnet-4.6` and `claude-sonnet-4-6` are the same | |
| model under two spellings and share `model_canonical = claude-sonnet-4-6`. | |
| `deepseek-chat` is kept as its own id here, as in the full corpus; those episodes say | |
| on air that DeepSeek v3.2 wrote them. | |
| ## Use | |
| ```python | |
| from datasets import load_dataset | |
| ds = load_dataset("My-Weird-Prompts/model-chronicle", split="train") | |
| ``` | |
| The writing models' providers set their own terms on using model output, including | |
| for training other models; check them before fine-tuning on these scripts. For a | |
| fine-tuning set curated with that in mind, contact show@myweirdprompts.com. | |
| ## License | |
| [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). Attribute to | |
| My Weird Prompts / Daniel Rosehill. | |
| """ | |
| def main() -> None: | |
| ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) | |
| ap.add_argument("--dry-run", action="store_true", help="build files, do not push to the Hub") | |
| ap.add_argument("--out", type=Path, help="directory for chronicle.jsonl + README.md (default: a temp dir)") | |
| args = ap.parse_args() | |
| rows, summary = build(fetch_rows()) | |
| built_at = datetime.now(timezone.utc).strftime("%Y-%m-%d") | |
| out_dir = args.out or Path(tempfile.mkdtemp(prefix="mwp-chronicle-")) | |
| out_dir.mkdir(parents=True, exist_ok=True) | |
| with open(out_dir / "chronicle.jsonl", "w") as f: | |
| for r in rows: | |
| f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| (out_dir / "README.md").write_text(card(rows, summary, built_at)) | |
| SITE_JSON.parent.mkdir(parents=True, exist_ok=True) | |
| site = { | |
| "generated": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"), | |
| "dataset": f"https://huggingface.co/datasets/{HF_REPO}", | |
| "rows": [{k: v for k, v in r.items() if k != "transcript"} for r in rows], | |
| } | |
| SITE_JSON.write_text(json.dumps(site, indent=1, ensure_ascii=False) + "\n") | |
| print(f"{len(rows)} picks from {len(summary)} models -> {out_dir}") | |
| for canon, s in summary.items(): | |
| print(f" {canon:28} {s['picks']} picks pool={s['pool']:15} pool_size={s['pool_size']:5} episodes={s['episodes']}") | |
| print(f"site json -> {SITE_JSON}") | |
| if args.dry_run: | |
| return | |
| from huggingface_hub import HfApi | |
| token = os.environ.get("HF_TOKEN") or None # falls back to stored credentials, as sync_hf_dataset.py does | |
| api = HfApi(token=token) | |
| api.create_repo(HF_REPO, repo_type="dataset", private=False, exist_ok=True) | |
| api.upload_folder( | |
| repo_id=HF_REPO, | |
| repo_type="dataset", | |
| folder_path=str(out_dir), | |
| allow_patterns=["chronicle.jsonl", "README.md"], | |
| commit_message=f"Build model chronicle: {len(rows)} scripts, {len(summary)} models ({built_at})", | |
| ) | |
| api.upload_file( | |
| repo_id=HF_REPO, | |
| repo_type="dataset", | |
| path_or_fileobj=__file__, | |
| path_in_repo="scripts/build_model_chronicle.py", | |
| commit_message="Upload the build script", | |
| ) | |
| print(f"pushed -> https://huggingface.co/datasets/{HF_REPO}") | |
| if __name__ == "__main__": | |
| main() | |