bench-standard 0.5.0: fix silent exits and signals, check declared values, hash the model

Fixes:
- A run on a machine without nvidia-smi/xpu-smi (every AMD box) exited
  silently with status 1 after BetterBench: the power sampler had already
  exited, so `kill` failed under set -e. No summary, no post_run, no done.
- Ctrl-C or kill didn't stop the script: the INT/TERM traps cleaned up and
  carried on, so a partial run could print a summary and `done:`. Now
  BetterBench is stopped at once and the folder is renamed .interrupted. The
  one-file bench.sh exec's the real script, so kill PID reaches it.
- Redaction turned --max-num-batched-tokens=8192 into <redacted>, corrupting
  the launch note. Env-style secrets and user:pass@ in URLs are still redacted.
- The --kv check was inverted when only -ctk is set: it warned on the
  correct q8_0/f16 and accepted q8_0.
- Negative flag values (-t -1) were parsed as flags.
- Model sizes in the HF cache counted symlinks, not the weights.
- A failed greedy check was recorded without any message.

Improvements:
- The served model is hashed (cached) and checked against the README's table
  (dev/models.txt), with a --quant cross-check.
- --spec, --thinking and vLLM --tp/--pp are checked against the launch
  command, like --kv; warnings name the value to declare.
- Weights are found through docker -v/--mount for any launch command, not
  only llama-swap's, and vLLM repo ids through the HF cache.
- AMD power and clock are sampled from amdgpu's hwmon sysfs files.
- Warnings are repeated after the summary and in the dry run, and saved in
  meta.json; the summary is saved as summary.txt.
- dev/test.sh: 36 end-to-end tests with a fake server and fake BetterBench,
  no GPU; CI runs them under dash and bash, plus shellcheck and build --check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9aTJE7srSQEYUqdQio
This commit is contained in:
Claude committed 2026-11-01 20:05:40 +00:00
1 parent b892e7b14d
commit b36805d1cb
14 files changed
+1004 -206

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
"""fake_server.py - a stand-in OpenAI-compatible server for dev/test.sh.
usage: fake_server.py PORT ENGINE [REASONING] [MODEL_PATH]
ENGINE llama.cpp | vllm
REASONING 1: replies carry reasoning_content
MODEL_PATH what /props or /v1/models reports as the model file
"""
import json
import sys
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
port, engine = int(sys.argv[1]), sys.argv[2]
reasoning = len(sys.argv) > 3 and sys.argv[3] == "1"
model_path = sys.argv[4] if len(sys.argv) > 4 else "/models/test.gguf"
class H(BaseHTTPRequestHandler):
def log_message(self, *a):
pass
def send(self, obj, code=200):
b = json.dumps(obj).encode()
self.send_response(code)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(b)))
self.end_headers()
self.wfile.write(b)
def do_GET(self):
p = self.path.rstrip("/")
if engine == "llama.cpp" and p == "/props":
self.send({"build_info": "b9999-abcdef0", "model_path": model_path,
"total_slots": 4, "default_generation_settings": {"n_ctx": 32768}})
elif engine == "vllm" and p == "/version":
self.send({"version": "0.99.0"})
elif p == "/v1/models":
self.send({"data": [{"id": "test-model", "owned_by": engine.replace(".cpp", ""),
"root": model_path, "max_model_len": 32768}]})
else:
self.send({"error": "not found"}, 404)
def do_POST(self):
n = int(self.headers.get("Content-Length", 0))
req = json.loads(self.rfile.read(n) or b"{}")
if req.get("model") != "test-model":
return self.send({"error": "unknown model"}, 404)
msg = {"role": "assistant", "content": "2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37."}
if reasoning:
msg["reasoning_content"] = "Let me think about primes."
self.send({"choices": [{"message": msg, "finish_reason": "stop"}]})
ThreadingHTTPServer(("127.0.0.1", port), H).serve_forever()