jubba-io commited on
Commit
39b67ca
·
verified ·
1 Parent(s): 94ea707

Reserve output ownership before model and paid inference

Browse files
Files changed (5) hide show
  1. README.md +6 -0
  2. SHA256SUMS +4 -4
  3. VALIDATION.md +3 -1
  4. artifact_manifest.json +3 -3
  5. run_sampling.py +29 -12
README.md CHANGED
@@ -70,6 +70,12 @@ Native mode and artifact verification need no key. No key is stored in weights,
70
  configuration, prompts or the published artifact. Hosted use incurs the
71
  provider's charges and requires access to the pinned Jev model.
72
 
 
 
 
 
 
 
73
  ## Input and limits
74
 
75
  ```json
 
70
  configuration, prompts or the published artifact. Hosted use incurs the
71
  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. Inspect
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
+
79
  ## Input and limits
80
 
81
  ```json
SHA256SUMS CHANGED
@@ -1,15 +1,15 @@
1
  c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b LICENSE
2
  9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc NOTICE.md
3
- 8679aa68911edbdc4ecac01880ebade8e6127def1736e976537f107ac7b06b82 README.md
4
  0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2 SECURITY.md
5
- f98fcf58ccc697d1b3f518d8142e2615c8c64a950e79cc6e3163ee6512bd58ac VALIDATION.md
6
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 _client/__init__.py
7
  c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a _client/jev.py
8
  3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151 _client/types.py
9
- 955658eb160bcb6d9dce6ad84d526993559b8765523bbe4c831b68e0722f5e52 artifact_manifest.json
10
  41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603 example.json
11
  d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda requirements.txt
12
- e3867cbf3d6f858c9d4118a33d8244c6ddf5472b128b64fc26c7d78dd50184d6 run_sampling.py
13
  1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd runtime.py
14
  1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe source_manifest.json
15
  4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c validation/release-e2e.json
 
1
  c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b LICENSE
2
  9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc NOTICE.md
3
+ bac708d0da76a86588b773daeab2d56cb1ff45e5d59c7111a43d64590fa76268 README.md
4
  0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2 SECURITY.md
5
+ 425c3a1b7ad2a9eff937a732b181031e99b5f9f6c20771d43691a9b5fbef2e80 VALIDATION.md
6
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 _client/__init__.py
7
  c87bb0b5c5e202f67623b42d9a5a390bc87ca28ba48acc4b9a63362a70a4fe2a _client/jev.py
8
  3591d0eef912255d3df2c5b2107da8cc44ee6b0507d40e72e09c2814f09c9151 _client/types.py
9
+ 34b3bff8d6835abd9c0e2aa1114475eb888805f90254edfbc47e0f4546598bea artifact_manifest.json
10
  41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603 example.json
11
  d4351148fcc569c924a11d3c0a24f5fb14381ad6cce960ed74a4e6f555301bda requirements.txt
12
+ 16d22f677e24529e080c3bc7fda7e33fbe16b87565806a4f6106e3256c8bafc7 run_sampling.py
13
  1cd89b7ec1f6352614f42616bc6e513d613a84338b5498b46586541b9d0115cd runtime.py
14
  1ff430aba1a3cd4a194cdfb278701457c963bee33dc66137fd7b024b56007bfe source_manifest.json
15
  4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c validation/release-e2e.json
VALIDATION.md CHANGED
@@ -8,12 +8,14 @@ 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
- - Sixteen 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,
15
  agreed and verified outcomes now bind the input, and verified outcomes hash the
16
  exact Jev payload. This changes record metadata, not generation or selection.
 
 
17
  - The initial full source-repository suite passed 1,083 tests on Azure; documentation,
18
  lint, formatting and package-build checks passed. Initial failures in a tar-only
19
  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
+ - Seventeen 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,
15
  agreed and verified outcomes now bind the input, and verified outcomes hash the
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
artifact_manifest.json CHANGED
@@ -6,19 +6,19 @@
6
  "verifier": "jev-1.13.0",
7
  "new_weights": false,
8
  "files": {
9
- "run_sampling.py": "e3867cbf3d6f858c9d4118a33d8244c6ddf5472b128b64fc26c7d78dd50184d6",
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": "8679aa68911edbdc4ecac01880ebade8e6127def1736e976537f107ac7b06b82",
17
  "NOTICE.md": "9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc",
18
  "SECURITY.md": "0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2",
19
  "LICENSE": "c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b",
20
  "example.json": "41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603",
21
- "VALIDATION.md": "f98fcf58ccc697d1b3f518d8142e2615c8c64a950e79cc6e3163ee6512bd58ac",
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": "16d22f677e24529e080c3bc7fda7e33fbe16b87565806a4f6106e3256c8bafc7",
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": "bac708d0da76a86588b773daeab2d56cb1ff45e5d59c7111a43d64590fa76268",
17
  "NOTICE.md": "9536fa2f6c4051093a1b1126ffaaee528d2a5324f12f15fd6cba9a5a9b0b99cc",
18
  "SECURITY.md": "0975fa492a2b9b059963e731cd34ac81be7d3790eb77d6479b188c3dbc7650f2",
19
  "LICENSE": "c758d4f7878f1d7bc304c083b9fe1a7392933e5cd7fc9fe641f266c14c93978b",
20
  "example.json": "41183c6e3b669411f3bd24de7282509cf8d484021dbc1cc62c305c1a53f28603",
21
+ "VALIDATION.md": "425c3a1b7ad2a9eff937a732b181031e99b5f9f6c20771d43691a9b5fbef2e80",
22
  "validation/release-smoke.json": "e632a7df8125c6a5c1047a8e1443588c699fff79c05542b06e5dc6db9aeadd24",
23
  "validation/release-e2e.json": "4040a30deafa507e87151e813800d172991939a69e8633e35883d4abc8a9993c"
24
  }
run_sampling.py CHANGED
@@ -348,8 +348,16 @@ def main():
348
  p.error("--input is required unless --verify")
349
  if args.output and args.output.exists():
350
  p.error("Output already exists")
 
351
  try:
352
  value = prepare_case(json.loads(args.input.read_text()))
 
 
 
 
 
 
 
353
  runner = GraniteJevSampling(
354
  device=args.device, key_file=args.key_file, local_files_only=args.local_files_only
355
  )
@@ -361,23 +369,32 @@ def main():
361
  replicate=args.replicate,
362
  )
363
  content = json.dumps(result, indent=2, allow_nan=False) + "\n"
364
- if args.output:
365
- with args.output.open("x") as stream:
366
- stream.write(content)
 
 
367
  else:
368
  print(content)
369
  except Exception as exc:
370
- print(
371
- json.dumps(
372
- dict(
373
- status="failed",
374
- error_type=type(exc).__name__,
375
- usage_unknown=getattr(exc, "usage_unknown", False),
376
- )
377
- ),
378
- file=sys.stderr,
379
  )
 
 
 
 
 
 
 
 
 
380
  raise SystemExit(1) from None
 
 
 
381
 
382
 
383
  if __name__ == "__main__":
 
348
  p.error("--input is required unless --verify")
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
+ output_stream.write(
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
  )
 
369
  replicate=args.replicate,
370
  )
371
  content = json.dumps(result, indent=2, allow_nan=False) + "\n"
372
+ if output_stream is not None:
373
+ output_stream.seek(0)
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", False),
 
 
 
 
 
384
  )
385
+ if output_stream is not None:
386
+ try:
387
+ output_stream.seek(0)
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)
394
  raise SystemExit(1) from None
395
+ finally:
396
+ if output_stream is not None:
397
+ output_stream.close()
398
 
399
 
400
  if __name__ == "__main__":