langfun 0.1.2.dev202504110804__py3-none-any.whl → 0.1.2.dev202504120803__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.
Potentially problematic release.
This version of langfun might be problematic. Click here for more details.
- langfun/core/eval/v2/evaluation.py +9 -12
- langfun/core/eval/v2/example.py +21 -1
- {langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/METADATA +1 -1
- {langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/RECORD +7 -7
- {langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/WHEEL +0 -0
- {langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/top_level.txt +0 -0
@@ -724,18 +724,15 @@ class EvaluationState:
|
|
724
724
|
filter: Callable[[example_lib.Example], bool] | None = None, # pylint: disable=redefined-builtin
|
725
725
|
) -> None:
|
726
726
|
"""Loads the state from the example sequence file."""
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
continue
|
737
|
-
example.newly_processed = False
|
738
|
-
self._ckpt_examples[example.id] = example
|
727
|
+
for example in example_lib.Example.iter_ckpts(
|
728
|
+
state_file,
|
729
|
+
example_input_by_id=example_input_by_id,
|
730
|
+
load_example_metadata=load_example_metadata,
|
731
|
+
):
|
732
|
+
if filter is not None and not filter(example):
|
733
|
+
continue
|
734
|
+
example.newly_processed = False
|
735
|
+
self._ckpt_examples[example.id] = example
|
739
736
|
|
740
737
|
@property
|
741
738
|
def evaluation_status(self) -> dict[int, ExampleStatus]:
|
langfun/core/eval/v2/example.py
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
import dataclasses
|
17
17
|
import inspect
|
18
|
-
from typing import Any, Callable
|
18
|
+
from typing import Any, Callable, Iterator
|
19
19
|
import langfun.core as lf
|
20
20
|
import pyglove as pg
|
21
21
|
|
@@ -145,6 +145,26 @@ class Example(pg.JSONConvertible, pg.views.HtmlTreeView.Extension):
|
|
145
145
|
example.metadata = pg.from_json(metadata_dict, **kwargs)
|
146
146
|
return example
|
147
147
|
|
148
|
+
@classmethod
|
149
|
+
def iter_ckpts(
|
150
|
+
cls,
|
151
|
+
ckpt_file: str | list[str],
|
152
|
+
example_input_by_id: Callable[[int], Any] | None = None,
|
153
|
+
load_example_metadata: bool = True,
|
154
|
+
) -> Iterator['Example']:
|
155
|
+
"""Iterates Examples from the checkpoint files."""
|
156
|
+
ckpt_files = [ckpt_file] if isinstance(ckpt_file, str) else ckpt_file
|
157
|
+
for ckpt_file in ckpt_files:
|
158
|
+
with pg.io.open_sequence(ckpt_file) as f:
|
159
|
+
for record in f:
|
160
|
+
example = pg.from_json_str(
|
161
|
+
record,
|
162
|
+
example_input_by_id=example_input_by_id,
|
163
|
+
load_example_metadata=load_example_metadata
|
164
|
+
)
|
165
|
+
assert isinstance(example, cls), example
|
166
|
+
yield example
|
167
|
+
|
148
168
|
#
|
149
169
|
# HTML rendering.
|
150
170
|
#
|
@@ -63,9 +63,9 @@ langfun/core/eval/v2/__init__.py,sha256=9lNKJwbvl0lcFblAXYT_OHI8fOubJsTOdSkxEqsP
|
|
63
63
|
langfun/core/eval/v2/checkpointing.py,sha256=t47rBfzGZYgIqWW1N1Ak9yQnNtHd-IRbEO0cZjG2VRo,11755
|
64
64
|
langfun/core/eval/v2/checkpointing_test.py,sha256=NggOSJ_6XSa4cNP6nGIu9wLsK59dUwe8SPWDiXtGGDE,9197
|
65
65
|
langfun/core/eval/v2/eval_test_helper.py,sha256=sKFi_wPYCNmr96WyTduuXY0KnxjFxcJyEhXey-_nGX8,3962
|
66
|
-
langfun/core/eval/v2/evaluation.py,sha256=
|
66
|
+
langfun/core/eval/v2/evaluation.py,sha256=E5PlPb9AA4VV12wHkwH-TXj-3BmYzr1GqhGFcY8gVvs,23882
|
67
67
|
langfun/core/eval/v2/evaluation_test.py,sha256=TKbeyeenoaUDH23E3TXXJ4otuq3VZBuWkWdV7c5vMk4,6804
|
68
|
-
langfun/core/eval/v2/example.py,sha256=
|
68
|
+
langfun/core/eval/v2/example.py,sha256=Jegt-viQSNYzPVkOZE_M19GON2TYGTct4Cp9HnJ7DGo,10861
|
69
69
|
langfun/core/eval/v2/example_test.py,sha256=1DNm6EuyZOq827DKvf3oTRVFkMNM_qTnLUpvOjpgz5I,3419
|
70
70
|
langfun/core/eval/v2/experiment.py,sha256=hHNyIw1uSV-hW2nMMx4hV-uul7KwXCmp7jAWNRyT5fU,32938
|
71
71
|
langfun/core/eval/v2/experiment_test.py,sha256=UmCobeS6ifPcaGkTJp0WPISolXrVFbeFCBiyJeA0Lt4,13666
|
@@ -156,8 +156,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
|
|
156
156
|
langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
|
157
157
|
langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
|
158
158
|
langfun/core/templates/selfplay_test.py,sha256=Ot__1P1M8oJfoTp-M9-PQ6HUXqZKyMwvZ5f7yQ3yfyM,2326
|
159
|
-
langfun-0.1.2.
|
160
|
-
langfun-0.1.2.
|
161
|
-
langfun-0.1.2.
|
162
|
-
langfun-0.1.2.
|
163
|
-
langfun-0.1.2.
|
159
|
+
langfun-0.1.2.dev202504120803.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
160
|
+
langfun-0.1.2.dev202504120803.dist-info/METADATA,sha256=425wS7mJbBj9ud9wfkWPDmCw9fmluo-qREBCcBZ06tk,7692
|
161
|
+
langfun-0.1.2.dev202504120803.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
162
|
+
langfun-0.1.2.dev202504120803.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
|
163
|
+
langfun-0.1.2.dev202504120803.dist-info/RECORD,,
|
File without changes
|
{langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{langfun-0.1.2.dev202504110804.dist-info → langfun-0.1.2.dev202504120803.dist-info}/top_level.txt
RENAMED
File without changes
|