verifiers 0.3.2.dev116__py3-none-any.whl → 0.3.2.dev117__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
verifiers/v1/rollout.py CHANGED
@@ -485,7 +485,9 @@ class Rollout:
485
485
  )
486
486
  if self._collect_artifacts and not trace.state.artifacts:
487
487
  trace.state.artifacts = await collect(
488
- runtime, self.task.data.artifacts
488
+ runtime,
489
+ self.task.data.artifacts,
490
+ max_bytes=self.task.data.artifact_max_bytes,
489
491
  )
490
492
  now = time.time()
491
493
  trace.timing.finalize.end = now
@@ -1,8 +1,8 @@
1
1
  """Remote Prime VM sandbox runtime."""
2
2
 
3
3
  import asyncio
4
- import base64
5
4
  import contextlib
5
+ import io
6
6
  import logging
7
7
  import math
8
8
  import shlex
@@ -329,19 +329,30 @@ class PrimeRuntime(Runtime):
329
329
  async def _read(self, path: str, max_bytes: int | None = None) -> bytes:
330
330
  if max_bytes is not None:
331
331
  try:
332
- # VM execute_command uses bash and returns the complete output stream.
333
- result = await self._client.execute_command(
332
+ # Stream binary output: execute_command buffers base64 text for the
333
+ # entire file. Bound the source read and the host buffer independently.
334
+ process = await self._client.open_process(
334
335
  self.info.id,
335
- f"set -o pipefail; head -c {max_bytes} -- {shlex.quote(path)} | base64",
336
+ f"head -c {max_bytes} -- {shlex.quote(path)}",
336
337
  working_dir=self.config.workdir,
337
338
  env=self.process_env({}),
338
- timeout=EFFECTIVELY_UNBOUNDED_SECONDS,
339
339
  )
340
+ async with contextlib.aclosing(process):
341
+ with io.BytesIO() as data:
342
+ async for chunk in process.stdout:
343
+ if data.tell() + len(chunk) > max_bytes:
344
+ raise SandboxError(
345
+ "read stream exceeded its byte limit"
346
+ )
347
+ data.write(chunk)
348
+ stderr = b""
349
+ async for chunk in process.stderr:
350
+ stderr = (stderr + chunk)[-500:]
351
+ if await process.wait():
352
+ raise SandboxError(stderr.decode(errors="replace").strip())
353
+ return data.getvalue()
340
354
  except Exception as exc:
341
355
  raise SandboxError(f"read {path!r}: {exc}") from exc
342
- if result.exit_code:
343
- raise SandboxError(f"read {path!r}: {result.stderr.strip()[-500:]}")
344
- return base64.b64decode(result.stdout)
345
356
  # Avoid background-job log limits and base64 overhead by downloading binary data directly.
346
357
  # The temporary file is removed on every exit, and its byte read stays off the event loop.
347
358
  target = (
verifiers/v1/task.py CHANGED
@@ -25,7 +25,7 @@ from verifiers.v1.configs.task import TaskConfig
25
25
  from verifiers.v1.errors import TaskError, boundary
26
26
  from verifiers.v1.state import StateT
27
27
  from verifiers.v1.types import Messages, content_text
28
- from verifiers.v1.utils.artifacts import Artifact
28
+ from verifiers.v1.utils.artifacts import MAX_ARTIFACT_BYTES, Artifact
29
29
  from verifiers.v1.utils.decorators import (
30
30
  discover_decorated,
31
31
  invoke_all,
@@ -115,6 +115,8 @@ class TaskData(BaseModel):
115
115
  on top of the implicitly collected `/logs/artifacts/` convention dir. Declare
116
116
  runtime outputs that must cross that boundary. A declared path that is missing at
117
117
  collection time fails the rollout."""
118
+ artifact_max_bytes: int = Field(MAX_ARTIFACT_BYTES, gt=0)
119
+ """Total byte limit for collected artifact archives, including the convention dir."""
118
120
 
119
121
  timeout: TaskTimeout = TaskTimeout()
120
122
  resources: TaskResources = TaskResources()
@@ -40,7 +40,7 @@ from verifiers.v1.state import State
40
40
  from verifiers.v1.task import Task, TaskData, TaskResources, TaskTimeout
41
41
  from verifiers.v1.taskset import Taskset
42
42
  from verifiers.v1.trace import Trace
43
- from verifiers.v1.utils.artifacts import Artifact, collect
43
+ from verifiers.v1.utils.artifacts import MAX_ARTIFACT_BYTES, Artifact, collect
44
44
  from verifiers.v1.utils.decorators import reward
45
45
 
46
46
  logger = logging.getLogger(__name__)
@@ -61,6 +61,8 @@ class HarborTaskConfig(TaskConfig):
61
61
 
62
62
 
63
63
  class HarborConfig(TasksetConfig):
64
+ artifact_max_bytes: int = Field(MAX_ARTIFACT_BYTES, gt=0)
65
+ """Total byte limit for artifact archives transferred out of each solver runtime."""
64
66
  task: HarborTaskConfig = HarborTaskConfig()
65
67
  dataset: str = "harbor/hello-world"
66
68
  """A Harbor Hub package id ("org/name" or "org/name@ref"), where ref is a
@@ -272,7 +274,9 @@ class HarborTask(Task[HarborData, State, HarborTaskConfig]):
272
274
  f"{hook.command}\n{detail}"
273
275
  )
274
276
  if not self.scoring_deferred:
275
- trace.state.artifacts = await collect(runtime, self.data.artifacts)
277
+ trace.state.artifacts = await collect(
278
+ runtime, self.data.artifacts, max_bytes=self.data.artifact_max_bytes
279
+ )
276
280
 
277
281
  async def stage_verifier(self, trace: Trace, runtime: Runtime) -> None:
278
282
  if any(
@@ -582,6 +586,7 @@ def parse_task(task_dir: Path, idx: int, harbor_config: HarborConfig) -> HarborD
582
586
  )
583
587
  return HarborData(
584
588
  idx=idx,
589
+ artifact_max_bytes=harbor_config.artifact_max_bytes,
585
590
  name=harbor_task.name,
586
591
  description=task.description if task else None,
587
592
  prompt=harbor_task.instruction.strip(),
@@ -21,7 +21,7 @@ ARTIFACTS_DIR = "/logs/artifacts"
21
21
  """Implicit artifact directory; tasks that write here need no declaration."""
22
22
 
23
23
  MAX_ARTIFACT_BYTES = 32 * 1024 * 1024
24
- """Ceiling per collection. Sized for a delta, not a tree: the grading box boots from the
24
+ """Default ceiling per collection. Sized for a delta, not a tree: the grading box boots from the
25
25
  agent's image, so the repo is already there and only its output has to travel."""
26
26
 
27
27
 
@@ -35,7 +35,10 @@ class Artifact(BaseModel):
35
35
 
36
36
 
37
37
  async def collect(
38
- runtime: Runtime, artifacts: list[Artifact] | None = None
38
+ runtime: Runtime,
39
+ artifacts: list[Artifact] | None = None,
40
+ *,
41
+ max_bytes: int = MAX_ARTIFACT_BYTES,
39
42
  ) -> dict[str, bytes | None]:
40
43
  """Tar the convention dir and every declared path out of `runtime`.
41
44
 
@@ -114,7 +117,7 @@ async def collect(
114
117
  )
115
118
  existence.extend(output.splitlines())
116
119
  collected: dict[str, bytes | None] = {}
117
- budget = MAX_ARTIFACT_BYTES
120
+ budget = max_bytes
118
121
  for artifact, exists in zip(entries, existence, strict=True):
119
122
  source = artifact.source
120
123
  if exists != "1":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev116
3
+ Version: 0.3.2.dev117
4
4
  Summary: Verifiers: Environments for LLM Reinforcement Learning
5
5
  Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
6
6
  Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
@@ -8,11 +8,11 @@ verifiers/v1/errors.py,sha256=uQySmCUrjDYFkBIii1vBFPiEcPFPQZ9EGpas_6HvcQI,5279
8
8
  verifiers/v1/graph.py,sha256=b3Z3lCnsALnAvY82pDnjhODFYakkeLV_hXgGOvbryrQ,40737
9
9
  verifiers/v1/harness.py,sha256=EmOmoen9ACsEgoUoS9-A7jpS2RyDg6ZlDbGo4APHU8E,15367
10
10
  verifiers/v1/judge.py,sha256=uqn-djkK2_7Q3kOjkDo6ipOvV_HOvuLa9y6AoDjRux8,9618
11
- verifiers/v1/rollout.py,sha256=oka3sNdv1EbE6LatFFRMJH-5ti6FcqFuD8xa7oVUyDA,24405
11
+ verifiers/v1/rollout.py,sha256=yN6MoQ3ZiXoLUhg4MxKAmM1zDpukyqyGZHsc0tushfc,24515
12
12
  verifiers/v1/semantic.py,sha256=VQ_buw6Ya6QtRoh_fiYI5Avs5RmIQCfWH0H0bQc4aoc,4704
13
13
  verifiers/v1/session.py,sha256=7iarEDRH2epID_O8ai-1HwveXze_o8shnLw9pFMFX5o,18900
14
14
  verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
15
- verifiers/v1/task.py,sha256=7iJLXQo7JKX5jG87atIwT_HZlSto_3a7yB3w__uQQQw,12427
15
+ verifiers/v1/task.py,sha256=j7pX-MMZwixSIp4344V5KDI443VGRL4YEs8S6Ukwmr8,12599
16
16
  verifiers/v1/taskset.py,sha256=fp2E0IEhL_Ybj9cegZwljfTmW27p_30zTWHFKw_kXE4,4374
17
17
  verifiers/v1/trace.py,sha256=q88vHOr3ZwvhzXOneBx00ZQ82fry7UT4DCwidQnbk3Q,32120
18
18
  verifiers/v1/types.py,sha256=PH1SxRWXOjPCgQD9aZgM18_bECvFSNQ25gkCbulmTKU,9857
@@ -145,7 +145,7 @@ verifiers/v1/runtimes/base.py,sha256=IKmrJSJltWX9M1nPUZExKluPJM4N82VsnqQGFz0ECV8
145
145
  verifiers/v1/runtimes/container.py,sha256=puQD8X9acP6GefoCNEnq40POi-nXPD-729bUjTVShfM,9554
146
146
  verifiers/v1/runtimes/limiters.py,sha256=C6cWDD4pwyFwUY4QFke3oiMXwydSNIfSbJSIglUC2kE,3062
147
147
  verifiers/v1/runtimes/modal.py,sha256=rFbxdDBi_VIiDA67XyZg-AOsc_XkV8aQWSKnTUAgCmU,17506
148
- verifiers/v1/runtimes/prime.py,sha256=eeYGu60f8PSGtL6g0nJslYzrQLHo6d64JP73N3q3xTw,16982
148
+ verifiers/v1/runtimes/prime.py,sha256=BXwDK-eurEzOKLY1ezuC0UYZdEoI0Y9Cfcd0IhKjMPc,17586
149
149
  verifiers/v1/runtimes/subprocess.py,sha256=QmpQ235_xrX6gowrr8557VgbydOXpLbfFq0KKGfJThk,8774
150
150
  verifiers/v1/runtimes/docker/__init__.py,sha256=2wceP-8V-w0dQBEeLtoJFfCZ135DxP2rcdcUBmSWiNU,18543
151
151
  verifiers/v1/runtimes/docker/egress.py,sha256=wtKWTL2_zFidxMR7lDRmfevQlOsl2Iyk88ebdO4Kqqw,24566
@@ -159,7 +159,7 @@ verifiers/v1/serve/types.py,sha256=Qw5IjiJhsZz4giSXUBi9dfInBnQZ5_xiUmgH2qp8jPI,1
159
159
  verifiers/v1/tasksets/__init__.py,sha256=5hTKSPLXSZTgKBbeKQI7FEp06c0ZsaQfuwvrvVFLgb8,712
160
160
  verifiers/v1/tasksets/harbor/__init__.py,sha256=JxThzHFYEkuSfQbVf3pEnjordgdfe4MU-QOsSSbyovU,326
161
161
  verifiers/v1/tasksets/harbor/env.py,sha256=ATMkfwmrE_2jpOOffbjLQ91feG7TOtefBGlpwWbRq8c,3604
162
- verifiers/v1/tasksets/harbor/taskset.py,sha256=3xCxtVVwQSpaLfoV1SaUoNQlpIGaTmwW6PvPyYh3yv4,33780
162
+ verifiers/v1/tasksets/harbor/taskset.py,sha256=35ljhNapn1EOlaYFTuVZxAMVU0KDfmFxQOGOcUk2Ow0,34082
163
163
  verifiers/v1/tasksets/harbor/toolset.py,sha256=_7HXu-uuvqzhmJ1EX6c3KWLg0g0eRrLjCq1kBsZhIwo,3159
164
164
  verifiers/v1/tasksets/lean/__init__.py,sha256=oyv-GbJQBvCyGwo7Ysxm2NjZW-aX4j1uDoHU0f-E7xQ,767
165
165
  verifiers/v1/tasksets/lean/scoring.py,sha256=sfzsT6MUK0zdMgAQ57_P_0CBaPHy3M7go71QMr5hDrs,10599
@@ -175,7 +175,7 @@ verifiers/v1/tasksets/textarena/__init__.py,sha256=Os2OlBY_pSH0B1DP32RitumgSLpq2
175
175
  verifiers/v1/tasksets/textarena/taskset.py,sha256=9fa_unlFiFZyuN4I02rW3x4qyRnFWXqwTUZTloQefu0,4433
176
176
  verifiers/v1/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
177
177
  verifiers/v1/utils/aio.py,sha256=0yNFOqB2oO6Qktc6NI_ZSAGuo1aHsIK_wuT1BtmoZ3I,1532
178
- verifiers/v1/utils/artifacts.py,sha256=PFrSkwAyvzHyT6JjlFeGOPIXDmS-uRajaN3am4HZ0TI,9263
178
+ verifiers/v1/utils/artifacts.py,sha256=3so4KLKlrtF2sM_jMZUAyjTHWnfuUltGX1MrrLns-tI,9315
179
179
  verifiers/v1/utils/compile.py,sha256=5pxy31wx2Q-3pQjOO5B9SH6OT-wwb8r4F1LAl6HMeQA,5835
180
180
  verifiers/v1/utils/decorators.py,sha256=vhoN6YoKb15-Fkqmc9RaNlUIbt9WRvNK4zAn2bAxfS4,5367
181
181
  verifiers/v1/utils/format.py,sha256=yX160sGewMMZn9iJqTHRbYYt4Z9pHasjMlFT1dXrKD8,2446
@@ -192,8 +192,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
192
192
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
193
193
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
194
194
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
195
- verifiers-0.3.2.dev116.dist-info/METADATA,sha256=vdkfWMbTMvOZzP2kW5qs0O09Lgxe98ObwxkMG7oZp-A,4237
196
- verifiers-0.3.2.dev116.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
197
- verifiers-0.3.2.dev116.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
198
- verifiers-0.3.2.dev116.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
199
- verifiers-0.3.2.dev116.dist-info/RECORD,,
195
+ verifiers-0.3.2.dev117.dist-info/METADATA,sha256=LIgiQlG8mlmytpzxUpHQpGLzD7F-bOpNG8AIKhhGyFA,4237
196
+ verifiers-0.3.2.dev117.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
197
+ verifiers-0.3.2.dev117.dist-info/entry_points.txt,sha256=iugElcdWPKbQM7uFF0lZ8iUpHsNr17-BwEAAjJWxV3U,259
198
+ verifiers-0.3.2.dev117.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
199
+ verifiers-0.3.2.dev117.dist-info/RECORD,,