verifiers 0.3.2.dev43__py3-none-any.whl → 0.3.2.dev44__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/episode.py +7 -2
- verifiers/v1/graph.py +32 -1
- verifiers/v1/trace.py +11 -4
- {verifiers-0.3.2.dev43.dist-info → verifiers-0.3.2.dev44.dist-info}/METADATA +1 -1
- {verifiers-0.3.2.dev43.dist-info → verifiers-0.3.2.dev44.dist-info}/RECORD +8 -8
- {verifiers-0.3.2.dev43.dist-info → verifiers-0.3.2.dev44.dist-info}/WHEEL +0 -0
- {verifiers-0.3.2.dev43.dist-info → verifiers-0.3.2.dev44.dist-info}/entry_points.txt +0 -0
- {verifiers-0.3.2.dev43.dist-info → verifiers-0.3.2.dev44.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/episode.py
CHANGED
|
@@ -6,6 +6,7 @@ from typing import Annotated, Any, Generic, Literal, Self
|
|
|
6
6
|
from pydantic import BaseModel, Field, model_validator
|
|
7
7
|
|
|
8
8
|
from verifiers.v1.configs.agent import WireAgentConfig
|
|
9
|
+
from verifiers.v1.graph import RECORD_FLOAT_DECIMALS
|
|
9
10
|
from verifiers.v1.state import State, StateT
|
|
10
11
|
from verifiers.v1.task import DataT, WireTaskData
|
|
11
12
|
from verifiers.v1.trace import EXCLUDE_FIELDS, AgentConfigT, Error, Trace, TraceTask
|
|
@@ -146,12 +147,16 @@ class Episode(BaseModel, Generic[DataT, StateT, AgentConfigT]):
|
|
|
146
147
|
grouped.setdefault(trace.agent.name, []).append(trace)
|
|
147
148
|
return grouped
|
|
148
149
|
|
|
149
|
-
def to_record(
|
|
150
|
-
|
|
150
|
+
def to_record(
|
|
151
|
+
self, float_decimals: int | None = RECORD_FLOAT_DECIMALS
|
|
152
|
+
) -> dict[str, Any]:
|
|
153
|
+
"""JSON record without raw trace tensors, which remain on the msgpack wire.
|
|
154
|
+
Per-token float streams are rounded to `float_decimals` (`None` keeps every digit)."""
|
|
151
155
|
return self.model_dump(
|
|
152
156
|
mode="json",
|
|
153
157
|
exclude={"traces": {"__all__": EXCLUDE_FIELDS}},
|
|
154
158
|
exclude_none=True,
|
|
159
|
+
context={"float_decimals": float_decimals},
|
|
155
160
|
)
|
|
156
161
|
|
|
157
162
|
|
verifiers/v1/graph.py
CHANGED
|
@@ -28,7 +28,14 @@ from dataclasses import dataclass
|
|
|
28
28
|
from typing import TYPE_CHECKING, Any
|
|
29
29
|
|
|
30
30
|
import numpy as np
|
|
31
|
-
from pydantic import
|
|
31
|
+
from pydantic import (
|
|
32
|
+
BaseModel,
|
|
33
|
+
ConfigDict,
|
|
34
|
+
Field,
|
|
35
|
+
FieldSerializationInfo,
|
|
36
|
+
field_serializer,
|
|
37
|
+
field_validator,
|
|
38
|
+
)
|
|
32
39
|
from pydantic.json_schema import SkipJsonSchema
|
|
33
40
|
from renderers.base import MultiModalData, PlaceholderRange, RenderedTokens
|
|
34
41
|
|
|
@@ -65,6 +72,14 @@ def _decode_ndarray(d: dict) -> np.ndarray:
|
|
|
65
72
|
return np.frombuffer(d["data"], dtype=np.dtype(d["dtype"])).reshape(d["shape"])
|
|
66
73
|
|
|
67
74
|
|
|
75
|
+
RECORD_FLOAT_DECIMALS = 4
|
|
76
|
+
"""Default precision of per-token float streams in JSON records (`to_record`). Full-precision
|
|
77
|
+
digits are noise to every record reader and the least compressible bytes of a trace; four
|
|
78
|
+
decimals leave a logprob within 1e-4 of what the trainer saw. `to_record(float_decimals=...)`
|
|
79
|
+
overrides it per dump (`None` keeps every digit). The msgpack wire (`mode="python"`) keeps
|
|
80
|
+
full precision — training never reads the record."""
|
|
81
|
+
|
|
82
|
+
|
|
68
83
|
class MessageNode(BaseModel):
|
|
69
84
|
"""One message in the graph: a message plus the tokens it adds to the cumulative
|
|
70
85
|
sequence. Concatenating a root→leaf path's nodes reconstructs that branch's full token
|
|
@@ -150,6 +165,22 @@ class MessageNode(BaseModel):
|
|
|
150
165
|
|
|
151
166
|
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
152
167
|
|
|
168
|
+
@field_serializer(
|
|
169
|
+
"logprobs",
|
|
170
|
+
"advantages",
|
|
171
|
+
"reference_logprobs",
|
|
172
|
+
"trainer_logprobs",
|
|
173
|
+
"entropies",
|
|
174
|
+
when_used="json",
|
|
175
|
+
)
|
|
176
|
+
def serialize_record_floats(
|
|
177
|
+
self, values: list[float] | None, info: FieldSerializationInfo
|
|
178
|
+
) -> list[float] | None:
|
|
179
|
+
decimals = (info.context or {}).get("float_decimals", RECORD_FLOAT_DECIMALS)
|
|
180
|
+
if values is None or decimals is None:
|
|
181
|
+
return values
|
|
182
|
+
return [round(value, decimals) for value in values]
|
|
183
|
+
|
|
153
184
|
@field_serializer("multi_modal_data")
|
|
154
185
|
def serialize_multi_modal_data(self, mmd: MultiModalData | None) -> dict | None:
|
|
155
186
|
"""`MultiModalData` -> msgpack-safe dict so the pixel tensors ride the wire; numpy
|
verifiers/v1/trace.py
CHANGED
|
@@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
|
|
18
18
|
from verifiers.v1 import graph
|
|
19
19
|
from verifiers.v1.configs.agent import AgentConfig, WireAgentConfig
|
|
20
20
|
from verifiers.v1.errors import ProviderError
|
|
21
|
-
from verifiers.v1.graph import MessageNode
|
|
21
|
+
from verifiers.v1.graph import RECORD_FLOAT_DECIMALS, MessageNode
|
|
22
22
|
from verifiers.v1.runtimes import RuntimeInfo
|
|
23
23
|
from verifiers.v1.semantic import (
|
|
24
24
|
ACPInfo,
|
|
@@ -728,9 +728,16 @@ class Trace(BaseModel, Generic[DataT, StateT, AgentConfigT]):
|
|
|
728
728
|
self.ok = False
|
|
729
729
|
self.stop("error")
|
|
730
730
|
|
|
731
|
-
def to_record(
|
|
732
|
-
|
|
733
|
-
|
|
731
|
+
def to_record(
|
|
732
|
+
self, float_decimals: int | None = RECORD_FLOAT_DECIMALS
|
|
733
|
+
) -> dict[str, Any]:
|
|
734
|
+
"""JSON record without raw tensors, which remain available on the msgpack wire.
|
|
735
|
+
Per-token float streams are rounded to `float_decimals` (`None` keeps every digit)."""
|
|
736
|
+
return self.model_dump(
|
|
737
|
+
mode="json",
|
|
738
|
+
exclude=EXCLUDE_FIELDS,
|
|
739
|
+
context={"float_decimals": float_decimals},
|
|
740
|
+
)
|
|
734
741
|
|
|
735
742
|
|
|
736
743
|
WireTrace = Trace[WireTaskData, State, WireAgentConfig]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.3.2.
|
|
3
|
+
Version: 0.3.2.dev44
|
|
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
|
|
@@ -2,9 +2,9 @@ verifiers/__init__.py,sha256=yDYsckVQbUkwoh9mU_hBeCLGvS_aWgAxuoNm5LxQpDI,517
|
|
|
2
2
|
verifiers/v1/__init__.py,sha256=qJKOsiUADKX4C1tMKsAPQXiJMo9-80FNeyPpAyRVshY,8352
|
|
3
3
|
verifiers/v1/agent.py,sha256=doqKNn77Ldm1EIe-V69IwgBbMiN79FoVnvMcyZA0pNM,32223
|
|
4
4
|
verifiers/v1/env.py,sha256=CEhzjojhg5jqbOYruUnc5U7TtgDHDSx8NiiFA0qfbt8,18234
|
|
5
|
-
verifiers/v1/episode.py,sha256=
|
|
5
|
+
verifiers/v1/episode.py,sha256=Fft0R2W6INAVeJhoE9b8h7L_KQSz7XuxP4FT_XhcsUY,5741
|
|
6
6
|
verifiers/v1/errors.py,sha256=uQySmCUrjDYFkBIii1vBFPiEcPFPQZ9EGpas_6HvcQI,5279
|
|
7
|
-
verifiers/v1/graph.py,sha256=
|
|
7
|
+
verifiers/v1/graph.py,sha256=K6wKkoT_8TpNqPQISu2Xf0eHtAYW_KUGw0CteN5zr3c,36529
|
|
8
8
|
verifiers/v1/harness.py,sha256=Yx-XCIs1HAmqv1F-nhCTDBUwAx51xQWNWgFcWL1WRTM,13777
|
|
9
9
|
verifiers/v1/judge.py,sha256=uqn-djkK2_7Q3kOjkDo6ipOvV_HOvuLa9y6AoDjRux8,9618
|
|
10
10
|
verifiers/v1/rollout.py,sha256=hoKGn1CbShbyjEM9PgYq8pdKgoC91VebTkBSgUHLtiE,23978
|
|
@@ -13,7 +13,7 @@ verifiers/v1/session.py,sha256=xM7JJJVJACk0JfH9RAN1Ts8gJJKr2tGGRiIgQTrdieY,18692
|
|
|
13
13
|
verifiers/v1/state.py,sha256=EckF2bWp-vV4b1jYJ9sLI5xrfGuI5spIgYYwW926toI,595
|
|
14
14
|
verifiers/v1/task.py,sha256=vaVkBu00riiNU1Ke4NeeY2NQTXxOguz9d6NLe55hO_Q,11468
|
|
15
15
|
verifiers/v1/taskset.py,sha256=fp2E0IEhL_Ybj9cegZwljfTmW27p_30zTWHFKw_kXE4,4374
|
|
16
|
-
verifiers/v1/trace.py,sha256
|
|
16
|
+
verifiers/v1/trace.py,sha256=8KCGMF2iaUNH_PypKNx--QwbSsl5dUCGeXp9Dmkm-24,29623
|
|
17
17
|
verifiers/v1/types.py,sha256=PH1SxRWXOjPCgQD9aZgM18_bECvFSNQ25gkCbulmTKU,9857
|
|
18
18
|
verifiers/v1/acp/__init__.py,sha256=wUPZVYBFjJuOnIIoYONBFuA04A1DJf_dOyKY3QwK37Q,12722
|
|
19
19
|
verifiers/v1/acp/runner.py,sha256=gMXFmsVg2qD0Zhrx7kvC6Me2Z-wsfBamRIO0i45UW8g,11097
|
|
@@ -185,8 +185,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
|
|
|
185
185
|
verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
|
|
186
186
|
verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
|
|
187
187
|
verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
|
|
188
|
-
verifiers-0.3.2.
|
|
189
|
-
verifiers-0.3.2.
|
|
190
|
-
verifiers-0.3.2.
|
|
191
|
-
verifiers-0.3.2.
|
|
192
|
-
verifiers-0.3.2.
|
|
188
|
+
verifiers-0.3.2.dev44.dist-info/METADATA,sha256=B0BGMenQq8aKxh-kAWwQ1xfbmu0Q1cXac2ZgyEefDkk,4065
|
|
189
|
+
verifiers-0.3.2.dev44.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
190
|
+
verifiers-0.3.2.dev44.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
|
|
191
|
+
verifiers-0.3.2.dev44.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
192
|
+
verifiers-0.3.2.dev44.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|