verifiers 0.4.2.dev134__py3-none-any.whl → 0.4.2.dev136__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/grading.py +46 -1
- verifiers/v1/harnesses/rlm/harness.py +6 -1
- {verifiers-0.4.2.dev134.dist-info → verifiers-0.4.2.dev136.dist-info}/METADATA +1 -1
- {verifiers-0.4.2.dev134.dist-info → verifiers-0.4.2.dev136.dist-info}/RECORD +7 -7
- {verifiers-0.4.2.dev134.dist-info → verifiers-0.4.2.dev136.dist-info}/WHEEL +0 -0
- {verifiers-0.4.2.dev134.dist-info → verifiers-0.4.2.dev136.dist-info}/entry_points.txt +0 -0
- {verifiers-0.4.2.dev134.dist-info → verifiers-0.4.2.dev136.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/grading.py
CHANGED
|
@@ -6,8 +6,11 @@ import logging
|
|
|
6
6
|
from contextlib import AsyncExitStack, asynccontextmanager, contextmanager
|
|
7
7
|
from pathlib import PurePosixPath
|
|
8
8
|
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
9
11
|
from verifiers.v1.configs.scoring import ScoringConfig
|
|
10
12
|
from verifiers.v1.errors import TaskError, boundary
|
|
13
|
+
from verifiers.v1.graph import MessageNode
|
|
11
14
|
from verifiers.v1.runtimes import (
|
|
12
15
|
NetworkPolicyConfig,
|
|
13
16
|
PrimeConfig,
|
|
@@ -207,6 +210,48 @@ async def stage_verifier(task: Task, trace: Trace, runtime: Runtime) -> None:
|
|
|
207
210
|
await invoke(task.stage_verifier, {"trace": trace, "runtime": runtime})
|
|
208
211
|
|
|
209
212
|
|
|
213
|
+
def _copy_grading_nodes(nodes: list[MessageNode]) -> list[MessageNode]:
|
|
214
|
+
"""Copy messages and node metadata, sharing read-only views of the training arrays."""
|
|
215
|
+
memo = {}
|
|
216
|
+
for node in nodes:
|
|
217
|
+
values = list(vars(node).values())
|
|
218
|
+
if node.loss_weights:
|
|
219
|
+
values.extend(node.loss_weights.values())
|
|
220
|
+
if node.sampler_support is not None:
|
|
221
|
+
values.extend(vars(node.sampler_support).values())
|
|
222
|
+
for value in values:
|
|
223
|
+
if isinstance(value, np.ndarray) and id(value) not in memo:
|
|
224
|
+
view = value.view()
|
|
225
|
+
view.flags.writeable = False
|
|
226
|
+
memo[id(value)] = view
|
|
227
|
+
return copy.deepcopy(nodes, memo)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _copy_trace_for_grading(trace: Trace) -> Trace:
|
|
231
|
+
"""Give each attempt its own scoring state and editable message graph."""
|
|
232
|
+
result = trace.model_copy(
|
|
233
|
+
update={
|
|
234
|
+
"state": copy.deepcopy(trace.state),
|
|
235
|
+
"rewards": copy.deepcopy(trace.rewards),
|
|
236
|
+
"metrics": copy.deepcopy(trace.metrics),
|
|
237
|
+
"info": copy.deepcopy(trace.info),
|
|
238
|
+
"extra_usage": list(trace.extra_usage),
|
|
239
|
+
"stop_info": copy.deepcopy(trace.stop_info),
|
|
240
|
+
"errors": list(trace.errors),
|
|
241
|
+
"nodes": _copy_grading_nodes(trace.nodes),
|
|
242
|
+
"calls": list(trace.calls),
|
|
243
|
+
"tools": list(trace.tools),
|
|
244
|
+
"checkpoints": list(trace.checkpoints),
|
|
245
|
+
"request_rewrites": list(trace.request_rewrites),
|
|
246
|
+
"response_rewrites": list(trace.response_rewrites),
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
result._on_change = None
|
|
250
|
+
result._pending = {}
|
|
251
|
+
result._head_index = {}
|
|
252
|
+
return result
|
|
253
|
+
|
|
254
|
+
|
|
210
255
|
async def grade_task(
|
|
211
256
|
task: Task,
|
|
212
257
|
trace: Trace,
|
|
@@ -236,7 +281,7 @@ async def grade_task(
|
|
|
236
281
|
if deadline is not None and asyncio.get_running_loop().time() >= deadline:
|
|
237
282
|
raise TimeoutError("scoring budget exhausted")
|
|
238
283
|
async with AsyncExitStack() as stack:
|
|
239
|
-
grader, result = copy.deepcopy(task),
|
|
284
|
+
grader, result = copy.deepcopy(task), _copy_trace_for_grading(trace)
|
|
240
285
|
async with (
|
|
241
286
|
asyncio.timeout_at(deadline),
|
|
242
287
|
asyncio.timeout(timeouts.setup),
|
|
@@ -71,7 +71,7 @@ class CompactionConfig(BaseConfig):
|
|
|
71
71
|
class RLMHarnessConfig(HarnessConfig):
|
|
72
72
|
dialect: Literal["chat_completions"] = "chat_completions"
|
|
73
73
|
version: str = Field(
|
|
74
|
-
default="
|
|
74
|
+
default="b0e934c3262c84682667293c31f4978d7bc4d51e", min_length=1
|
|
75
75
|
)
|
|
76
76
|
"""Git ref (branch, tag, or commit) of nano-rlm to install. Must know every
|
|
77
77
|
field this harness puts on the wire, i.e. be at least the default ref."""
|
|
@@ -84,6 +84,9 @@ class RLMHarnessConfig(HarnessConfig):
|
|
|
84
84
|
builtin_tools: list[BuiltinTool] | None = None
|
|
85
85
|
"""Native tool selection; None uses nano-rlm's default and is omitted from the
|
|
86
86
|
runtime contract. Explicit selection requires a nano-rlm ref supporting it."""
|
|
87
|
+
vision: bool = False
|
|
88
|
+
"""Send images from IPython and MCP tools to a vision-capable model. Requires a
|
|
89
|
+
nano-rlm version with the vision execution policy."""
|
|
87
90
|
compaction: CompactionConfig | bool | None = None
|
|
88
91
|
"""Context compaction: a `[compaction]` section (or `true`) enables it with the
|
|
89
92
|
given settings, `false` disables it (an overflowing session then fails), and
|
|
@@ -216,6 +219,8 @@ class RLMHarness(ACPHarness[RLMHarnessConfig]):
|
|
|
216
219
|
"max_total_tokens": self.config.max_total_tokens or None,
|
|
217
220
|
"max_tool_output_bytes": self.config.max_tool_output_bytes,
|
|
218
221
|
}
|
|
222
|
+
if self.config.vision:
|
|
223
|
+
policy_knobs["vision"] = True
|
|
219
224
|
if isinstance(compaction, bool):
|
|
220
225
|
policy_knobs["compaction"] = compaction
|
|
221
226
|
elif compaction is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.4.2.
|
|
3
|
+
Version: 0.4.2.dev136
|
|
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
|
|
@@ -5,7 +5,7 @@ verifiers/v1/delta.py,sha256=ZdF-b7Qqpwg4WXrNyAO_VK82OEBFsQDOr_xkNWtQROs,12561
|
|
|
5
5
|
verifiers/v1/env.py,sha256=5F-LhPLAfVNwcco2TR-OOAnv0QtIj49X8pc_dSa-Hgk,20748
|
|
6
6
|
verifiers/v1/episode.py,sha256=Tqjo8aQDOh4sM03he2WMXzEhmn2ybzwwtUS_QSvESsA,6983
|
|
7
7
|
verifiers/v1/errors.py,sha256=sgguxm402rbWmCNar7kHpekb30VA7wvE88GBG8890v8,6049
|
|
8
|
-
verifiers/v1/grading.py,sha256=
|
|
8
|
+
verifiers/v1/grading.py,sha256=ukULZ4BW8ecj0HX7g1w4kN7R4qs2TmDOSr9XFN6gI-Y,15095
|
|
9
9
|
verifiers/v1/graph.py,sha256=_IEMMdOJ7TAy2TM9H9LZBAeYCgV9-Uo8XtfTUdg_aBI,48582
|
|
10
10
|
verifiers/v1/harness.py,sha256=3jJjA_Td8f61jzN33J7h0Hk_hUCe_pqh_ePjH_EVg7c,19067
|
|
11
11
|
verifiers/v1/judge.py,sha256=T-TyYVcLGIoyUADYKy_pCBj2CTLhERlct5pmmWqPpTA,10507
|
|
@@ -107,7 +107,7 @@ verifiers/v1/harnesses/pi/harness.py,sha256=HPU8-NWG6-1i1zVwNago31VAc6OQNvSGWjQh
|
|
|
107
107
|
verifiers/v1/harnesses/prime_agent/__init__.py,sha256=xfPC4RrlnyYWaf38tPAOZq4YL6M55lMpj5BoRLmaK8I,171
|
|
108
108
|
verifiers/v1/harnesses/prime_agent/harness.py,sha256=MBJJyNa2cCFHvYQGF511vekYYY7IoSEgX04aT2AKRks,13453
|
|
109
109
|
verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDbEdJ4uB8Ns,122
|
|
110
|
-
verifiers/v1/harnesses/rlm/harness.py,sha256=
|
|
110
|
+
verifiers/v1/harnesses/rlm/harness.py,sha256=PZrpEVIGNs2mDgYNLF16oUw8P7jfKMk3FAqEd7XItx8,16079
|
|
111
111
|
verifiers/v1/harnesses/stirrup/__init__.py,sha256=a-NQxX1bOwaGx8QHj2jWcRJEGiLIxdY6XUMbojr9dOk,142
|
|
112
112
|
verifiers/v1/harnesses/stirrup/harness.py,sha256=Bcm7m1IzFnseiAa6xRKHSFKYrqSRpvxkP07R4GTryfM,3458
|
|
113
113
|
verifiers/v1/harnesses/stirrup/program.py,sha256=zjrg6aJqtgXxiRPVFYGiRxuz72gDKvd2xmEYq9eZ7pM,17673
|
|
@@ -188,8 +188,8 @@ verifiers/v1/utils/scope.py,sha256=zbs4pj6AVk4jywlAJ3AX0Q0_kzB9dBB02nY-9H4ELdQ,8
|
|
|
188
188
|
verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
|
|
189
189
|
verifiers/v1/utils/trace_store.py,sha256=7F6xMhYgl3qmylnCU8-ekqswH16fUat1uegeM1OR9QQ,2563
|
|
190
190
|
verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
|
|
191
|
-
verifiers-0.4.2.
|
|
192
|
-
verifiers-0.4.2.
|
|
193
|
-
verifiers-0.4.2.
|
|
194
|
-
verifiers-0.4.2.
|
|
195
|
-
verifiers-0.4.2.
|
|
191
|
+
verifiers-0.4.2.dev136.dist-info/METADATA,sha256=clrnyH5MHixC06Z04cYB9cIyuMH_U60DArWfykcBea8,5118
|
|
192
|
+
verifiers-0.4.2.dev136.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
193
|
+
verifiers-0.4.2.dev136.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
|
|
194
|
+
verifiers-0.4.2.dev136.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
195
|
+
verifiers-0.4.2.dev136.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|