Preserve durable input and payload binding on verifier failures
Browse files- README.md +3 -1
- SHA256SUMS +4 -4
- VALIDATION.md +4 -1
- artifact_manifest.json +3 -3
- run_sampling.py +46 -16
README.md
CHANGED
|
@@ -72,7 +72,9 @@ provider's charges and requires access to the pinned Jev model.
|
|
| 72 |
|
| 73 |
The CLI exclusively reserves a new `--output` file before model loading or any
|
| 74 |
provider call, so two commands cannot spend on the same destination. It initially
|
| 75 |
-
records `in_progress` and retains an explicit failure if inference fails.
|
|
|
|
|
|
|
| 76 |
a leftover reservation before retrying; it is not a successful answer. This is
|
| 77 |
not a transactional job service or an automatic paid-request recovery mechanism.
|
| 78 |
|
|
|
|
| 72 |
|
| 73 |
The CLI exclusively reserves a new `--output` file before model loading or any
|
| 74 |
provider call, so two commands cannot spend on the same destination. It initially
|
| 75 |
+
records `in_progress` and retains an explicit failure if inference fails. Input
|
| 76 |
+
and verifier-payload hashes are flushed to disk before dispatch and retained
|
| 77 |
+
on failure; unknown charges remain explicit. Inspect
|
| 78 |
a leftover reservation before retrying; it is not a successful answer. This is
|
| 79 |
not a transactional job service or an automatic paid-request recovery mechanism.
|
| 80 |
|
SHA256SUMS
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b LICENSE
|
| 2 |
9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc NOTICE.md
|
| 3 |
-
|
| 4 |
0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2 SECURITY.md
|
| 5 |
-
|
| 6 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 _client/__init__.py
|
| 7 |
c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a _client/jev.py
|
| 8 |
3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151 _client/types.py
|
| 9 |
-
|
| 10 |
41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603 example.json
|
| 11 |
d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda requirements.txt
|
| 12 |
-
|
| 13 |
1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd runtime.py
|
| 14 |
1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe source_manifest.json
|
| 15 |
4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c validation/release-e2e.json
|
|
|
|
| 1 |
c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b LICENSE
|
| 2 |
9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc NOTICE.md
|
| 3 |
+
4dc2c3a843962af286c6f3ccc03d49ec81071ae4a488301ad322f789bfdb704b README.md
|
| 4 |
0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2 SECURITY.md
|
| 5 |
+
50d9d05fc17a67285f975fb49bc6ea4b7e577ac0ec6e2cc64627a947577e935b VALIDATION.md
|
| 6 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 _client/__init__.py
|
| 7 |
c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a _client/jev.py
|
| 8 |
3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151 _client/types.py
|
| 9 |
+
b1e882b1233ec60d5f2e5619b6cfd6b8880bc5a1413a4e99a9ef72a793d07d7d artifact_manifest.json
|
| 10 |
41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603 example.json
|
| 11 |
d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda requirements.txt
|
| 12 |
+
037d1f237d12b82bca26f9b0efdc726fa0af7d955634fa0a4f06d159f5146c03 run_sampling.py
|
| 13 |
1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd runtime.py
|
| 14 |
1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe source_manifest.json
|
| 15 |
4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c validation/release-e2e.json
|
VALIDATION.md
CHANGED
|
@@ -8,7 +8,7 @@ recorded for the exact Hugging Face revision in the source repository's
|
|
| 8 |
- Capability tests first failed on Azure because the new runner did not exist.
|
| 9 |
- Offline tests cover reference isolation, exact token ownership, agreement,
|
| 10 |
strict margin, invalid scores/version, absent credentials and provider failure.
|
| 11 |
-
-
|
| 12 |
parity, unchanged weights/private RNG, cache/context checks, credential-free
|
| 13 |
native mode, single-attempt transport, redirect rejection and artifact tampering.
|
| 14 |
- A review regression first exposed missing task/rubric provenance; saved native,
|
|
@@ -16,6 +16,9 @@ recorded for the exact Hugging Face revision in the source repository's
|
|
| 16 |
exact Jev payload. This changes record metadata, not generation or selection.
|
| 17 |
- A concurrent CLI regression first admitted two model loads for one destination;
|
| 18 |
an exclusive output reservation now rejects the second command before inference.
|
|
|
|
|
|
|
|
|
|
| 19 |
- The initial full source-repository suite passed 1,083 tests on Azure; documentation,
|
| 20 |
lint, formatting and package-build checks passed. Initial failures in a tar-only
|
| 21 |
checkout were traced to missing Git metadata; the complete suite was rerun in
|
|
|
|
| 8 |
- Capability tests first failed on Azure because the new runner did not exist.
|
| 9 |
- Offline tests cover reference isolation, exact token ownership, agreement,
|
| 10 |
strict margin, invalid scores/version, absent credentials and provider failure.
|
| 11 |
+
- Nineteen targeted tests passed on Azure, including tiny-model sampled/greedy
|
| 12 |
parity, unchanged weights/private RNG, cache/context checks, credential-free
|
| 13 |
native mode, single-attempt transport, redirect rejection and artifact tampering.
|
| 14 |
- A review regression first exposed missing task/rubric provenance; saved native,
|
|
|
|
| 16 |
exact Jev payload. This changes record metadata, not generation or selection.
|
| 17 |
- A concurrent CLI regression first admitted two model loads for one destination;
|
| 18 |
an exclusive output reservation now rejects the second command before inference.
|
| 19 |
+
- Failure-record regressions initially lacked the input binding; the CLI now
|
| 20 |
+
durably records input and payload identity before dispatch and retains them on
|
| 21 |
+
timeout or invalid response, without exposing raw provider error messages.
|
| 22 |
- The initial full source-repository suite passed 1,083 tests on Azure; documentation,
|
| 23 |
lint, formatting and package-build checks passed. Initial failures in a tar-only
|
| 24 |
checkout were traced to missing Git metadata; the complete suite was rerun in
|
artifact_manifest.json
CHANGED
|
@@ -6,19 +6,19 @@
|
|
| 6 |
"verifier": "jev-1.13.0",
|
| 7 |
"new_weights": false,
|
| 8 |
"files": {
|
| 9 |
-
"run_sampling.py": "
|
| 10 |
"runtime.py": "1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd",
|
| 11 |
"requirements.txt": "d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda",
|
| 12 |
"source_manifest.json": "1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe",
|
| 13 |
"_client/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
| 14 |
"_client/jev.py": "c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a",
|
| 15 |
"_client/types.py": "3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151",
|
| 16 |
-
"README.md": "
|
| 17 |
"NOTICE.md": "9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc",
|
| 18 |
"SECURITY.md": "0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2",
|
| 19 |
"LICENSE": "c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b",
|
| 20 |
"example.json": "41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603",
|
| 21 |
-
"VALIDATION.md": "
|
| 22 |
"validation/release-smoke.json": "e632a7df8125c6a5c1047a8e1443588c699fff79c05542b06e5dc6db9aeadd24",
|
| 23 |
"validation/release-e2e.json": "4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c"
|
| 24 |
}
|
|
|
|
| 6 |
"verifier": "jev-1.13.0",
|
| 7 |
"new_weights": false,
|
| 8 |
"files": {
|
| 9 |
+
"run_sampling.py": "037d1f237d12b82bca26f9b0efdc726fa0af7d955634fa0a4f06d159f5146c03",
|
| 10 |
"runtime.py": "1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd",
|
| 11 |
"requirements.txt": "d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda",
|
| 12 |
"source_manifest.json": "1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe",
|
| 13 |
"_client/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
| 14 |
"_client/jev.py": "c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a",
|
| 15 |
"_client/types.py": "3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151",
|
| 16 |
+
"README.md": "4dc2c3a843962af286c6f3ccc03d49ec81071ae4a488301ad322f789bfdb704b",
|
| 17 |
"NOTICE.md": "9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc",
|
| 18 |
"SECURITY.md": "0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2",
|
| 19 |
"LICENSE": "c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b",
|
| 20 |
"example.json": "41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603",
|
| 21 |
+
"VALIDATION.md": "50d9d05fc17a67285f975fb49bc6ea4b7e577ac0ec6e2cc64627a947577e935b",
|
| 22 |
"validation/release-smoke.json": "e632a7df8125c6a5c1047a8e1443588c699fff79c05542b06e5dc6db9aeadd24",
|
| 23 |
"validation/release-e2e.json": "4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c"
|
| 24 |
}
|
run_sampling.py
CHANGED
|
@@ -9,6 +9,7 @@ import importlib
|
|
| 9 |
import importlib.util
|
| 10 |
import json
|
| 11 |
import math
|
|
|
|
| 12 |
import runpy
|
| 13 |
import sys
|
| 14 |
import threading
|
|
@@ -124,7 +125,7 @@ def pair_payload(case, native, sample, replicate):
|
|
| 124 |
return dict(model=VERIFIER, state=state, questions=questions), binding
|
| 125 |
|
| 126 |
|
| 127 |
-
def resolve_pair(case, native, sample, replicate, verifier):
|
| 128 |
payload, binding = pair_payload(case, native["text"], sample["text"], replicate)
|
| 129 |
for candidate in (native, sample):
|
| 130 |
for key in ("prompt_token_ids", "generated_token_ids"):
|
|
@@ -141,6 +142,17 @@ def resolve_pair(case, native, sample, replicate, verifier):
|
|
| 141 |
called = native["text"] != sample["text"]
|
| 142 |
selected, action, scores, usage = native, "native", None, None
|
| 143 |
if called:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
response = verifier(payload)
|
| 145 |
values = response.get("values")
|
| 146 |
if (
|
|
@@ -258,7 +270,16 @@ class GraniteJevSampling:
|
|
| 258 |
raise ValueError("Unexpected EOS contract")
|
| 259 |
self.runtime = runpy.run_path(str(HERE / "runtime.py"))
|
| 260 |
|
| 261 |
-
def solve(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
case = prepare_case(value)
|
| 263 |
seed = sample_seed(case["id"], replicate)
|
| 264 |
if (
|
|
@@ -313,6 +334,7 @@ class GraniteJevSampling:
|
|
| 313 |
key_file=self.key_file,
|
| 314 |
timeout=min(90, max_seconds - (time.monotonic() - tick)),
|
| 315 |
),
|
|
|
|
| 316 |
)
|
| 317 |
return result | dict(
|
| 318 |
native=native,
|
|
@@ -349,15 +371,28 @@ def main():
|
|
| 349 |
if args.output and args.output.exists():
|
| 350 |
p.error("Output already exists")
|
| 351 |
output_stream = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
try:
|
| 353 |
value = prepare_case(json.loads(args.input.read_text()))
|
|
|
|
| 354 |
if args.output:
|
| 355 |
# Own the destination before model loading or paid provider work.
|
| 356 |
output_stream = args.output.open("x")
|
| 357 |
-
|
| 358 |
-
json.dumps(dict(status="in_progress", case_binding=case_binding(value))) + "\n"
|
| 359 |
-
)
|
| 360 |
-
output_stream.flush()
|
| 361 |
runner = GraniteJevSampling(
|
| 362 |
device=args.device, key_file=args.key_file, local_files_only=args.local_files_only
|
| 363 |
)
|
|
@@ -367,27 +402,22 @@ def main():
|
|
| 367 |
max_new_tokens=args.max_new_tokens,
|
| 368 |
max_seconds=args.max_seconds,
|
| 369 |
replicate=args.replicate,
|
|
|
|
| 370 |
)
|
| 371 |
content = json.dumps(result, indent=2, allow_nan=False) + "\n"
|
| 372 |
if output_stream is not None:
|
| 373 |
-
|
| 374 |
-
output_stream.truncate()
|
| 375 |
-
output_stream.write(content)
|
| 376 |
-
output_stream.flush()
|
| 377 |
else:
|
| 378 |
print(content)
|
| 379 |
except Exception as exc:
|
| 380 |
-
failure = dict(
|
| 381 |
status="failed",
|
| 382 |
error_type=type(exc).__name__,
|
| 383 |
-
usage_unknown=getattr(exc, "usage_unknown",
|
| 384 |
)
|
| 385 |
if output_stream is not None:
|
| 386 |
try:
|
| 387 |
-
|
| 388 |
-
output_stream.truncate()
|
| 389 |
-
output_stream.write(json.dumps(failure) + "\n")
|
| 390 |
-
output_stream.flush()
|
| 391 |
except OSError:
|
| 392 |
pass
|
| 393 |
print(json.dumps(failure), file=sys.stderr)
|
|
|
|
| 9 |
import importlib.util
|
| 10 |
import json
|
| 11 |
import math
|
| 12 |
+
import os
|
| 13 |
import runpy
|
| 14 |
import sys
|
| 15 |
import threading
|
|
|
|
| 125 |
return dict(model=VERIFIER, state=state, questions=questions), binding
|
| 126 |
|
| 127 |
|
| 128 |
+
def resolve_pair(case, native, sample, replicate, verifier, *, on_attempt=None):
|
| 129 |
payload, binding = pair_payload(case, native["text"], sample["text"], replicate)
|
| 130 |
for candidate in (native, sample):
|
| 131 |
for key in ("prompt_token_ids", "generated_token_ids"):
|
|
|
|
| 142 |
called = native["text"] != sample["text"]
|
| 143 |
selected, action, scores, usage = native, "native", None, None
|
| 144 |
if called:
|
| 145 |
+
if on_attempt is not None:
|
| 146 |
+
on_attempt(
|
| 147 |
+
dict(
|
| 148 |
+
case_binding=case_binding(case),
|
| 149 |
+
verifier_payload_sha256=digest(payload),
|
| 150 |
+
candidate_binding=binding,
|
| 151 |
+
replicate=replicate,
|
| 152 |
+
verifier_model=VERIFIER,
|
| 153 |
+
policy=POLICY,
|
| 154 |
+
)
|
| 155 |
+
)
|
| 156 |
response = verifier(payload)
|
| 157 |
values = response.get("values")
|
| 158 |
if (
|
|
|
|
| 270 |
raise ValueError("Unexpected EOS contract")
|
| 271 |
self.runtime = runpy.run_path(str(HERE / "runtime.py"))
|
| 272 |
|
| 273 |
+
def solve(
|
| 274 |
+
self,
|
| 275 |
+
value,
|
| 276 |
+
*,
|
| 277 |
+
mode="jev",
|
| 278 |
+
max_new_tokens=1024,
|
| 279 |
+
max_seconds=900,
|
| 280 |
+
replicate=3701,
|
| 281 |
+
on_verifier_attempt=None,
|
| 282 |
+
):
|
| 283 |
case = prepare_case(value)
|
| 284 |
seed = sample_seed(case["id"], replicate)
|
| 285 |
if (
|
|
|
|
| 334 |
key_file=self.key_file,
|
| 335 |
timeout=min(90, max_seconds - (time.monotonic() - tick)),
|
| 336 |
),
|
| 337 |
+
on_attempt=on_verifier_attempt,
|
| 338 |
)
|
| 339 |
return result | dict(
|
| 340 |
native=native,
|
|
|
|
| 371 |
if args.output and args.output.exists():
|
| 372 |
p.error("Output already exists")
|
| 373 |
output_stream = None
|
| 374 |
+
provenance = dict(verifier_payload_sha256=None, verifier_dispatch_prepared=False)
|
| 375 |
+
|
| 376 |
+
def persist(record):
|
| 377 |
+
if output_stream is not None:
|
| 378 |
+
output_stream.seek(0)
|
| 379 |
+
output_stream.truncate()
|
| 380 |
+
output_stream.write(json.dumps(record, indent=2, allow_nan=False) + "\n")
|
| 381 |
+
output_stream.flush()
|
| 382 |
+
os.fsync(output_stream.fileno())
|
| 383 |
+
|
| 384 |
+
def record_attempt(binding):
|
| 385 |
+
provenance.update(binding)
|
| 386 |
+
provenance["verifier_dispatch_prepared"] = True
|
| 387 |
+
persist(provenance | dict(status="in_progress", usage_unknown=True))
|
| 388 |
+
|
| 389 |
try:
|
| 390 |
value = prepare_case(json.loads(args.input.read_text()))
|
| 391 |
+
provenance["case_binding"] = case_binding(value)
|
| 392 |
if args.output:
|
| 393 |
# Own the destination before model loading or paid provider work.
|
| 394 |
output_stream = args.output.open("x")
|
| 395 |
+
persist(provenance | dict(status="in_progress"))
|
|
|
|
|
|
|
|
|
|
| 396 |
runner = GraniteJevSampling(
|
| 397 |
device=args.device, key_file=args.key_file, local_files_only=args.local_files_only
|
| 398 |
)
|
|
|
|
| 402 |
max_new_tokens=args.max_new_tokens,
|
| 403 |
max_seconds=args.max_seconds,
|
| 404 |
replicate=args.replicate,
|
| 405 |
+
on_verifier_attempt=record_attempt,
|
| 406 |
)
|
| 407 |
content = json.dumps(result, indent=2, allow_nan=False) + "\n"
|
| 408 |
if output_stream is not None:
|
| 409 |
+
persist(result)
|
|
|
|
|
|
|
|
|
|
| 410 |
else:
|
| 411 |
print(content)
|
| 412 |
except Exception as exc:
|
| 413 |
+
failure = provenance | dict(
|
| 414 |
status="failed",
|
| 415 |
error_type=type(exc).__name__,
|
| 416 |
+
usage_unknown=getattr(exc, "usage_unknown", provenance["verifier_dispatch_prepared"]),
|
| 417 |
)
|
| 418 |
if output_stream is not None:
|
| 419 |
try:
|
| 420 |
+
persist(failure)
|
|
|
|
|
|
|
|
|
|
| 421 |
except OSError:
|
| 422 |
pass
|
| 423 |
print(json.dumps(failure), file=sys.stderr)
|