Tablinum-3: apps, web, scicode, homerepair tables; code, recipes, packs, routes, sources, license, art
9728219 verified Download code/claude_judge.py from tablinum/tablinum-3: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/datasets/tablinum/tablinum-3/resolve/main/code/claude_judge.py
- Command line
-
hf download hf://datasets/tablinum/tablinum-3/code/claude_judge.py
-
curl -L -o claude_judge.py https://huggingface.co/datasets/tablinum/tablinum-3/resolve/main/code/claude_judge.py
1.64 kB
| """claude_judge.py (10-30) - judge backend for grade.py / homebench_grade.py / homebench_pair.py: JUDGE_URL (or --url) "claude:haiku" (or | |
| "claude:<model>") sends each grading prompt to the user's Claude subscription through the Claude Code CLI in print mode (no API key): | |
| replaced system prompt, no tools, no MCP, no session files, run from an empty scratch dir so no project CLAUDE.md is picked up. | |
| "haiku" resolved to claude-haiku-5-5 on 10-30. Retries with backoff on CLI / rate-limit errors. Everything sent = the grading prompt only | |
| (question, gold / key points, the model's answer).""" | |
| import json, os, subprocess, tempfile, time | |
| SYS = "You are a strict, impartial grader. Follow the requested output format exactly and output nothing else." | |
| _cwd = tempfile.mkdtemp(prefix="claude_judge_") | |
| def is_claude(url): | |
| return bool(url) and url.startswith("claude:") | |
| def chat(url, prompt, max_tokens=None, tries=4): | |
| model = url.split(":", 1)[1] or "haiku"; err = "" | |
| for k in range(tries): | |
| try: | |
| p = subprocess.run(["claude", "-p", "--model", model, "--system-prompt", SYS, "--tools", "", "--strict-mcp-config", "--no-session-persistence", | |
| "--output-format", "json"], input=prompt, capture_output=True, text=True, timeout=300, cwd=_cwd) | |
| d = json.loads(p.stdout) | |
| if not d.get("is_error") and d.get("result") is not None: | |
| return d["result"] | |
| err = str(d.get("result") or d)[:200] | |
| except Exception as e: | |
| err = str(e)[:200] | |
| time.sleep(5 * 2 ** k) | |
| raise RuntimeError(f"claude judge failed: {err}") | |