Keep real model benchmark validity checks active under optimization

This commit is contained in:
karl committed 2026-10-13 13:54:33 +02:00
1 parent d568bdb2b1
commit 66bf7d7b47
4 files changed
+79 -27

No files matched your search

@@ -14,7 +14,7 @@ from pathlib import Path
import platform
import statistics
import time
from benchmark import ROOT, Session, vectors
from benchmark import ROOT, Session, vectors, require
def memory(pid):
@@ -62,9 +62,9 @@ def main():
entry = manifest["files"][0]
model = args.models / entry["path"]
started = time.perf_counter()
assert model.stat().st_size == entry["bytes"]
require(model.stat().st_size == entry["bytes"], 'Benchmark contract failed at query_context_benchmark.py:65')
with model.open("rb") as stream:
assert hashlib.file_digest(stream, "sha256").hexdigest() == entry["sha256"]
require(hashlib.file_digest(stream, "sha256").hexdigest() == entry["sha256"], 'Benchmark contract failed at query_context_benchmark.py:67')
verification_ms = (time.perf_counter() - started) * 1000
samples = []
for repeat in range(args.repeats):
@@ -74,8 +74,8 @@ def main():
try:
hello = session.next()
startup_ms = (time.perf_counter() - session.started) * 1000
assert hello["device"] == "cpu" and not hello["vulkan_module_loaded"]
assert hello["role"] == role and hello["context_tokens"] == (512 if role == "query" else 2048)
require(hello["device"] == "cpu" and not hello["vulkan_module_loaded"], 'Benchmark contract failed at query_context_benchmark.py:77')
require(hello["role"] == role and hello["context_tokens"] == (512 if role == "query" else 2048), 'Benchmark contract failed at query_context_benchmark.py:78')
sample = {"repeat": repeat, "role": role, "hello": hello, "startup_ms": startup_ms, "ready_memory": memory(session.process.pid)}
response, first_ms = session.worker({"op": "query", "text": "cancel the supplier partnership", "debug_performance": True})
vectors(response, 1)
@@ -92,8 +92,8 @@ def main():
if role == "query":
session.send({"op": "documents", "texts": ["test"], "title": "none"})
rejected = session.next()
assert not rejected["ok"] and not rejected["fatal"]
assert "only supports" in rejected["error"]
require(not rejected["ok"] and not rejected["fatal"], 'Benchmark contract failed at query_context_benchmark.py:95')
require("only supports" in rejected["error"], 'Benchmark contract failed at query_context_benchmark.py:96')
vectors(session.worker({"op": "code_query", "text": "retry failed requests"})[0], 1)
samples.append(sample)
finally: