verifiers 0.4.2.dev114__py3-none-any.whl → 0.4.2.dev116__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/configs/scoring.py +9 -7
- verifiers/v1/configs/task.py +4 -3
- verifiers/v1/rollout.py +21 -14
- verifiers/v1/utils/decorators.py +12 -4
- {verifiers-0.4.2.dev114.dist-info → verifiers-0.4.2.dev116.dist-info}/METADATA +2 -2
- {verifiers-0.4.2.dev114.dist-info → verifiers-0.4.2.dev116.dist-info}/RECORD +9 -9
- {verifiers-0.4.2.dev114.dist-info → verifiers-0.4.2.dev116.dist-info}/WHEEL +0 -0
- {verifiers-0.4.2.dev114.dist-info → verifiers-0.4.2.dev116.dist-info}/entry_points.txt +0 -0
- {verifiers-0.4.2.dev114.dist-info → verifiers-0.4.2.dev116.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/configs/scoring.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Literal
|
|
4
4
|
|
|
5
|
-
from pydantic import Field, SerializationInfo, field_serializer
|
|
5
|
+
from pydantic import Field, FiniteFloat, SerializationInfo, field_serializer
|
|
6
6
|
from pydantic_config import BaseConfig
|
|
7
7
|
|
|
8
8
|
from verifiers.v1.configs.client import BaseClientConfig
|
|
@@ -50,12 +50,14 @@ class ScoringConfig(BaseConfig):
|
|
|
50
50
|
combined with the runtime's own rules the same way. None keeps the default: isolated
|
|
51
51
|
scoring runs under `TaskData.network`, shared scoring keeps the agent phase's network,
|
|
52
52
|
and Harbor's shared grading lifts the policy."""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(`Trace.is_timeout`)
|
|
53
|
+
skip: dict[Literal["truncated", "timeout", "format_violation"], FiniteFloat] = (
|
|
54
|
+
Field(default_factory=dict)
|
|
55
|
+
)
|
|
56
|
+
"""Skip task scoring for these reasons and record the value as a fixed reward named
|
|
57
|
+
after the reason. `truncated` matches `Trace.is_truncated`, `timeout` a stage
|
|
58
|
+
deadline that expired before scoring (`Trace.is_timeout`). A format violation is
|
|
59
|
+
never scored, so `format_violation` only sets its reward. A reason left out is
|
|
60
|
+
scored as usual, or, for a format violation, keeps no rewards."""
|
|
59
61
|
|
|
60
62
|
@field_serializer("runtime")
|
|
61
63
|
def serialize_runtime(
|
verifiers/v1/configs/task.py
CHANGED
|
@@ -24,9 +24,10 @@ class DecoratedFunctionConfig(BaseConfig):
|
|
|
24
24
|
class StopFunctionConfig(DecoratedFunctionConfig):
|
|
25
25
|
"""A plugged function standing in for a `@vf.stop` task method."""
|
|
26
26
|
|
|
27
|
-
skip_scoring: bool | None = None
|
|
28
|
-
"""Skip task scoring for a trace this stop ends: it keeps no rewards
|
|
29
|
-
|
|
27
|
+
skip_scoring: FiniteFloat | bool | None = None
|
|
28
|
+
"""Skip task scoring for a trace this stop ends: it keeps no task rewards. A number
|
|
29
|
+
instead of `true` also records it as a fixed reward named after the stop. Unset
|
|
30
|
+
keeps the replaced method's setting (false for a fresh function)."""
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class RewardFunctionConfig(DecoratedFunctionConfig):
|
verifiers/v1/rollout.py
CHANGED
|
@@ -245,8 +245,11 @@ class Rollout:
|
|
|
245
245
|
for fn in discover_decorated(task, "intercept")
|
|
246
246
|
]
|
|
247
247
|
stops = [(hook_boundary(fn, allow_trace=True), fn) for fn in task.hooks("stop")]
|
|
248
|
+
# Each `skip_scoring` stop, mapped to its fixed reward (None for `True`).
|
|
248
249
|
self._skip_scoring_stops = {
|
|
249
|
-
fn.__name__
|
|
250
|
+
fn.__name__: None if skip is True else float(skip)
|
|
251
|
+
for _, fn in stops
|
|
252
|
+
if (skip := getattr(fn, "stop_skip_scoring", False)) is not False
|
|
250
253
|
}
|
|
251
254
|
execution_policy = runtime_config
|
|
252
255
|
self._session = RolloutSession(
|
|
@@ -1442,17 +1445,18 @@ class Rollout:
|
|
|
1442
1445
|
"agent_completed",
|
|
1443
1446
|
)
|
|
1444
1447
|
|
|
1445
|
-
def
|
|
1448
|
+
def _scoring_skip(self) -> tuple[str, float | None] | None:
|
|
1446
1449
|
"""Why the resolved scoring policy, or the `skip_scoring` stop that ended this trace,
|
|
1447
|
-
skips task scoring for it, if either does."""
|
|
1450
|
+
skips task scoring for it, with the fixed reward that reason sets, if either does."""
|
|
1451
|
+
skip = self._scoring_policy.skip
|
|
1448
1452
|
if self.trace.is_format_violation:
|
|
1449
|
-
return "format_violation"
|
|
1450
|
-
if
|
|
1451
|
-
return "truncated"
|
|
1452
|
-
if
|
|
1453
|
-
return "timeout"
|
|
1454
|
-
if self.trace.stop_condition in self._skip_scoring_stops:
|
|
1455
|
-
return self.
|
|
1453
|
+
return "format_violation", skip.get("format_violation")
|
|
1454
|
+
if "truncated" in skip and self.trace.is_truncated:
|
|
1455
|
+
return "truncated", skip["truncated"]
|
|
1456
|
+
if "timeout" in skip and self.trace.is_timeout:
|
|
1457
|
+
return "timeout", skip["timeout"]
|
|
1458
|
+
if (stop := self.trace.stop_condition) in self._skip_scoring_stops:
|
|
1459
|
+
return stop, self._skip_scoring_stops[stop]
|
|
1456
1460
|
return None
|
|
1457
1461
|
|
|
1458
1462
|
def _metrics_deadline(self) -> float:
|
|
@@ -1484,7 +1488,7 @@ class Rollout:
|
|
|
1484
1488
|
self._closed = True
|
|
1485
1489
|
LIVE.discard(self)
|
|
1486
1490
|
trace = self.trace
|
|
1487
|
-
|
|
1491
|
+
skip = self._scoring_skip()
|
|
1488
1492
|
runtime = self.runtime
|
|
1489
1493
|
try:
|
|
1490
1494
|
if trace.timing.agent.start and not trace.timing.agent.end:
|
|
@@ -1594,9 +1598,12 @@ class Rollout:
|
|
|
1594
1598
|
boundary(TaskError, "scoring"),
|
|
1595
1599
|
):
|
|
1596
1600
|
# Cross-trace judgement runs later, after the runtime is gone.
|
|
1597
|
-
if
|
|
1598
|
-
|
|
1599
|
-
|
|
1601
|
+
if skip := skip or self._scoring_skip():
|
|
1602
|
+
reason, reward = skip
|
|
1603
|
+
logger.debug("Skipped scoring - %s", reason)
|
|
1604
|
+
trace.info["scoring_skipped"] = reason
|
|
1605
|
+
if reward is not None:
|
|
1606
|
+
trace.record_reward(reason, reward)
|
|
1600
1607
|
elif grader is not None:
|
|
1601
1608
|
# Grading in a box of its own stops this one first: an
|
|
1602
1609
|
# owner's snapshot must finish its upload before.
|
verifiers/v1/utils/decorators.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import inspect
|
|
5
|
+
import math
|
|
5
6
|
from collections.abc import Callable, Iterable
|
|
6
7
|
from typing import Any, TypeVar, get_origin, get_type_hints, overload
|
|
7
8
|
|
|
@@ -83,21 +84,28 @@ def tool(func: F | None = None, name: str | None = None) -> F | Callable[[F], F]
|
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
@overload
|
|
86
|
-
def stop(func: F, priority: int = 0, skip_scoring: bool = False) -> F: ...
|
|
87
|
+
def stop(func: F, priority: int = 0, skip_scoring: bool | float = False) -> F: ...
|
|
87
88
|
@overload
|
|
88
89
|
def stop(
|
|
89
|
-
func: None = None, priority: int = 0, skip_scoring: bool = False
|
|
90
|
+
func: None = None, priority: int = 0, skip_scoring: bool | float = False
|
|
90
91
|
) -> Callable[[F], F]: ...
|
|
91
92
|
def stop(
|
|
92
|
-
func: F | None = None, priority: int = 0, skip_scoring: bool = False
|
|
93
|
+
func: F | None = None, priority: int = 0, skip_scoring: bool | float = False
|
|
93
94
|
) -> F | Callable[[F], F]:
|
|
94
95
|
"""Stop when a typed `Request`, `Response`, or `Trace` predicate returns true (or
|
|
95
96
|
`(True, metadata)` to populate `trace.stop_info`). With `skip_scoring`, a trace
|
|
96
|
-
this stop ends skips task scoring
|
|
97
|
+
this stop ends skips task scoring and keeps no task rewards; a number instead of
|
|
98
|
+
`True` also records it as a fixed reward named after the stop."""
|
|
99
|
+
check_skip_scoring(skip_scoring)
|
|
97
100
|
decorator = mark("stop", stop_priority=priority, stop_skip_scoring=skip_scoring)
|
|
98
101
|
return decorator if func is None else decorator(func)
|
|
99
102
|
|
|
100
103
|
|
|
104
|
+
def check_skip_scoring(skip_scoring: bool | float) -> None:
|
|
105
|
+
if not isinstance(skip_scoring, bool) and not math.isfinite(skip_scoring):
|
|
106
|
+
raise ValueError(f"skip_scoring reward must be finite, got {skip_scoring}")
|
|
107
|
+
|
|
108
|
+
|
|
101
109
|
@overload
|
|
102
110
|
def intercept(func: F, priority: int = 0) -> F: ...
|
|
103
111
|
@overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.4.2.
|
|
3
|
+
Version: 0.4.2.dev116
|
|
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
|
|
@@ -34,7 +34,7 @@ Requires-Dist: numpy>=2.1.0
|
|
|
34
34
|
Requires-Dist: openai<3.0.0,>=2.54.0
|
|
35
35
|
Requires-Dist: orjson>=3.10.0
|
|
36
36
|
Requires-Dist: prime-pydantic-config[toml]>=0.4.3
|
|
37
|
-
Requires-Dist: prime-sandboxes>=0.5.
|
|
37
|
+
Requires-Dist: prime-sandboxes>=0.5.16
|
|
38
38
|
Requires-Dist: prime-tunnel>=0.1.17
|
|
39
39
|
Requires-Dist: pydantic>=2.12.3
|
|
40
40
|
Requires-Dist: renderers[multimodal]>=0.2.1.dev12
|
|
@@ -10,7 +10,7 @@ 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
|
|
12
12
|
verifiers/v1/restore.py,sha256=wFu3SnjsKw6RvyN0p2qoq4oBiuIM9RJXpoVkqg6rdeI,7408
|
|
13
|
-
verifiers/v1/rollout.py,sha256=
|
|
13
|
+
verifiers/v1/rollout.py,sha256=h2sFQJrqLwThdvQwr-pTd5O267tVjqSLdnf7WQWXs6M,83608
|
|
14
14
|
verifiers/v1/semantic.py,sha256=nqKPPUoPL5Oh8Es_XjtcbDiQiIMKTYayXEm-EPB-jAE,5129
|
|
15
15
|
verifiers/v1/session.py,sha256=W39D3WfQgIZGekzt7-2bBVrF-Kb_Uapdy5cnWepEcyw,52241
|
|
16
16
|
verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
|
|
@@ -45,9 +45,9 @@ verifiers/v1/configs/judge.py,sha256=nP5rE430PCtyLYIZ772EpWXEPZxg6GaiUgeGXOEj0v8
|
|
|
45
45
|
verifiers/v1/configs/retries.py,sha256=GIrwS0lnMKnlQ_Wj1Z2J6NlEYK4jX5weZxYmQmLcpUI,1793
|
|
46
46
|
verifiers/v1/configs/runtime.py,sha256=nzAWj4M2Sk62t-KtJyvUbl4VgK5AMcU4Ty7NXlvip2Y,12246
|
|
47
47
|
verifiers/v1/configs/sampling.py,sha256=yHYb-ymUg8MlXfNDn9VZ3yXL5SXNqrEDT6JLuMAovYU,1146
|
|
48
|
-
verifiers/v1/configs/scoring.py,sha256=
|
|
48
|
+
verifiers/v1/configs/scoring.py,sha256=yuehLEsBJSH4X6kCSm0-gaU2-ciuxYNkGN_EEkrxksE,4774
|
|
49
49
|
verifiers/v1/configs/select.py,sha256=a72aweHXsA1B9i-ShR710NZr4ZFC-0xfSQ5J8aQGrew,5820
|
|
50
|
-
verifiers/v1/configs/task.py,sha256=
|
|
50
|
+
verifiers/v1/configs/task.py,sha256=75PdyGgtJAELd6IsPcHOTmk8ybEabm6Vbog4sC7hiPo,3020
|
|
51
51
|
verifiers/v1/configs/taskset.py,sha256=OJG_DfM2_6I4Mm1-egMcrIEN6UtD2JaBaXnzW9SZXk8,906
|
|
52
52
|
verifiers/v1/configs/cli/__init__.py,sha256=YMDUPdbRlDJ77dhj3QqzmyRhqNgUvuQdpj_bdBqzZPM,78
|
|
53
53
|
verifiers/v1/configs/cli/debug.py,sha256=fGi9ym6q22X4dd6RO9-aa0vYYOhi-PHc2fmeZC-0inU,2757
|
|
@@ -169,7 +169,7 @@ verifiers/v1/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
169
169
|
verifiers/v1/utils/aio.py,sha256=0yNFOqB2oO6Qktc6NI_ZSAGuo1aHsIK_wuT1BtmoZ3I,1532
|
|
170
170
|
verifiers/v1/utils/artifacts.py,sha256=8-OGbVRFwRyYftpgszV1WQ20qEjMZG92aETcQuZOkN8,25216
|
|
171
171
|
verifiers/v1/utils/compile.py,sha256=wHGk9BKykVsniyXLr1fBQGRjnfG9QzEVEc92HYfT1V4,5219
|
|
172
|
-
verifiers/v1/utils/decorators.py,sha256=
|
|
172
|
+
verifiers/v1/utils/decorators.py,sha256=pq0ZS7pqeTxKZmqzz-asZZ0pZ_IemqsJncAX1YNhoFU,6067
|
|
173
173
|
verifiers/v1/utils/env.py,sha256=tMqfwFNRcJPijzrjkbE2VYvBH8eONRtYCWVkXHKpGZQ,1023
|
|
174
174
|
verifiers/v1/utils/eval.py,sha256=lXBsir3rastL31CuXkJi522v6ypAI1ZGQ82IoTkm8IQ,1237
|
|
175
175
|
verifiers/v1/utils/format.py,sha256=ij6sMMitJL7JCfGPSJp60gBZPYRVOpMGlTaiiV_UPag,594
|
|
@@ -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.dev116.dist-info/METADATA,sha256=Po0Nk1N8bE_vL9oJGP7u8d7HcBBkqtkYhEQYcvgJb74,5118
|
|
192
|
+
verifiers-0.4.2.dev116.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
193
|
+
verifiers-0.4.2.dev116.dist-info/entry_points.txt,sha256=qdMg7ajiFpDsHf7tuPMRclJXizu1J6LTWawS5YS0B0I,137
|
|
194
|
+
verifiers-0.4.2.dev116.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
195
|
+
verifiers-0.4.2.dev116.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|