mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 02:24:12 +01:00
Rebaselines the release suite and marker duration budgets to the slowest measured hosted release time + 25% (run 45678651612; suite 3910 s on py3.11 and 5340 s on py3.12; cpu 2010, integration 700, unmarked 2460) and owns every test whose time + 25% exceeds 15 s under #679 with a 90-day review (follow-up #684). Speeds up test_smaller_change rank1 (geometry environments built lazily) and the recipe-search fake edit step (a light helper module). The PR core gate now enforces per-test budgets on each shard's JUnit with a new --testcase-budgets-only mode; suite and marker totals stay release-only. Refs #679
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
"""Fake ``recipe _edit`` resolution writer shared by recipe search/confirmation tests.
|
|
|
|
Kept free of pytest and heavy test-module imports so that fake step subprocesses
|
|
(``python -c`` scripts launched by recipe search tests) import only the two
|
|
resolution modules they need instead of a whole test module and its imports.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from hashlib import sha256
|
|
from math import ceil, floor
|
|
from pathlib import Path
|
|
|
|
|
|
def _read(path):
|
|
return json.loads(path.read_text(encoding="utf-8"))
|
|
|
|
|
|
def write_edit_resolution(request):
|
|
from obliteratus.qualification import canonical_json
|
|
from obliteratus.recipes.resolution_records import _begin_application, write_resolution
|
|
|
|
stock = Path(request["stock"])
|
|
config = _read(stock / "config.json") if (stock / "config.json").is_file() else {}
|
|
recipe = request["recipe"]
|
|
record = _begin_application(
|
|
recipe, {**request["target"], "structure": {"tie_word_embeddings": None}},
|
|
input_sha256={name: pin["sha256"] for name, pin in recipe["inputs"].items() if "sha256" in pin},
|
|
runtime_bindings=[],
|
|
)
|
|
for actual, step in zip(record["steps"], recipe["pipeline"]["steps"], strict=True):
|
|
params = step["params"]
|
|
assert actual["params_sha256"] == sha256(canonical_json(params)).hexdigest()
|
|
if step["technique"] == "abliteration.projection":
|
|
layers = step["placement"].get("layers", params["backend"]["layers"])
|
|
if isinstance(layers, dict):
|
|
depth = config["num_hidden_layers"]
|
|
layers = list(range(floor(layers["start"] * depth), ceil(layers["end"] * depth)))
|
|
actual["payload"]["resolved_layers"] = layers
|
|
checkpoint = Path(request["checkpoint"])
|
|
checkpoint.mkdir(exist_ok=True)
|
|
write_resolution(checkpoint / "recipe-resolution.json", record)
|
|
return record
|