langfun 0.1.2.dev202505070805__py3-none-any.whl → 0.1.2.dev202505080804__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/experiment.py +12 -0
- langfun/core/eval/v2/runners.py +3 -0
- langfun/core/eval/v2/runners_test.py +9 -0
- {langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/METADATA +1 -1
- {langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/RECORD +8 -8
- {langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/WHEEL +0 -0
- {langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/licenses/LICENSE +0 -0
- {langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/top_level.txt +0 -0
@@ -382,6 +382,7 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
|
|
382
382
|
warm_start_from: str | None = None,
|
383
383
|
filter: Callable[['Experiment'], bool] | None = None, # pylint: disable=redefined-builtin
|
384
384
|
example_ids: list[int] | None = None,
|
385
|
+
shuffle_inputs: bool = False,
|
385
386
|
raise_if_has_error: bool = False,
|
386
387
|
reprocess: bool | list[int] = False,
|
387
388
|
generate_example_html: Literal['new', 'all', 'no'] | list[int] = 'new',
|
@@ -431,6 +432,8 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
|
|
431
432
|
filter: A filter function to decide whether an experiment should be run
|
432
433
|
or not.
|
433
434
|
example_ids: The example IDs to run. If None, it will run all examples.
|
435
|
+
shuffle_inputs: If True, the order of evaluatin examples will be shuffled.
|
436
|
+
Neverthless, the example ID remains unchanged for each example.
|
434
437
|
raise_if_has_error: If True, it will raise an error if any example fails.
|
435
438
|
Otherwise, it will continue and report the error in the output.
|
436
439
|
reprocess: A boolean or a list of example IDs. If boolean, it indicates
|
@@ -470,6 +473,7 @@ class Experiment(lf.Component, pg.views.HtmlTreeView.Extension):
|
|
470
473
|
warm_start_from=warm_start_from,
|
471
474
|
filter=filter,
|
472
475
|
example_ids=example_ids,
|
476
|
+
shuffle_inputs=shuffle_inputs,
|
473
477
|
raise_if_has_error=raise_if_has_error,
|
474
478
|
reprocess=reprocess,
|
475
479
|
generate_example_html=generate_example_html,
|
@@ -816,6 +820,14 @@ class Run(pg.Object, pg.views.html.HtmlTreeView.Extension):
|
|
816
820
|
)
|
817
821
|
] = None
|
818
822
|
|
823
|
+
shuffle_inputs: Annotated[
|
824
|
+
bool,
|
825
|
+
(
|
826
|
+
'If True, the order of evaluating examples will be shuffled.'
|
827
|
+
'Otherwise an increasing order will be used.'
|
828
|
+
)
|
829
|
+
] = False
|
830
|
+
|
819
831
|
raise_if_has_error: Annotated[
|
820
832
|
bool,
|
821
833
|
(
|
langfun/core/eval/v2/runners.py
CHANGED
@@ -356,6 +356,9 @@ class RunnerBase(Runner):
|
|
356
356
|
input=evaluation.example_input_by_id(example_id)
|
357
357
|
) for example_id in self.current_run.example_ids
|
358
358
|
)
|
359
|
+
if self.current_run.shuffle_inputs:
|
360
|
+
items = list(items)
|
361
|
+
random.shuffle(items)
|
359
362
|
self._evaluate_items(evaluation, items)
|
360
363
|
|
361
364
|
if cache:
|
@@ -163,6 +163,15 @@ class RunnerTest(unittest.TestCase):
|
|
163
163
|
self.assertEqual(plugin.started_example_ids, [5, 7, 9] * 6)
|
164
164
|
self.assertEqual(plugin.completed_example_ids, [5, 7, 9] * 6)
|
165
165
|
|
166
|
+
def test_shuffle_inputs(self):
|
167
|
+
root_dir = os.path.join(tempfile.gettempdir(), 'test_shuffle_inputs')
|
168
|
+
exp = eval_test_helper.test_experiment()
|
169
|
+
plugin = TestPlugin()
|
170
|
+
run = exp.run(
|
171
|
+
root_dir, runner='sequential', plugins=[plugin], shuffle_inputs=True
|
172
|
+
)
|
173
|
+
self.assertTrue(run.shuffle_inputs)
|
174
|
+
|
166
175
|
def test_filter(self):
|
167
176
|
plugin = TestPlugin()
|
168
177
|
exp = eval_test_helper.test_experiment()
|
@@ -67,7 +67,7 @@ langfun/core/eval/v2/evaluation.py,sha256=BijbrYufnlRZLryxezDU32gHjFCCZvLAZMLF6k
|
|
67
67
|
langfun/core/eval/v2/evaluation_test.py,sha256=QNp_HEvRTupvNuLEeYTvylykh1Ut2jpMqHQ-gCUZQ10,6919
|
68
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
|
-
langfun/core/eval/v2/experiment.py,sha256=
|
70
|
+
langfun/core/eval/v2/experiment.py,sha256=fb3RHNOSRftV7ZTBfYVV50iEevqdPwRHCt3mgtLzuFw,33408
|
71
71
|
langfun/core/eval/v2/experiment_test.py,sha256=UmCobeS6ifPcaGkTJp0WPISolXrVFbeFCBiyJeA0Lt4,13666
|
72
72
|
langfun/core/eval/v2/metric_values.py,sha256=_B905bC-jxrYPLSEcP2M8MaHZOVMz_bVrUw8YC4arCE,4660
|
73
73
|
langfun/core/eval/v2/metric_values_test.py,sha256=ab2oF_HsIwrSy459108ggyjgefHSPn8UVILR4dRwx14,2634
|
@@ -79,8 +79,8 @@ langfun/core/eval/v2/progress_tracking.py,sha256=zNhNPGlnJnHELEfFpbTMCSXFn8d1IJ5
|
|
79
79
|
langfun/core/eval/v2/progress_tracking_test.py,sha256=fouMVJkFJqHjbhQJngGLGCmA9x3n0dU4USI2dY163mg,2291
|
80
80
|
langfun/core/eval/v2/reporting.py,sha256=yUIPCAMnp7InIzpv1DDWrcLO-75iiOUTpscj7smkfrA,8335
|
81
81
|
langfun/core/eval/v2/reporting_test.py,sha256=hcPJJaMtPulqERvHYTpId83WXdqDKnnexmULtK7WKwk,5686
|
82
|
-
langfun/core/eval/v2/runners.py,sha256=
|
83
|
-
langfun/core/eval/v2/runners_test.py,sha256=
|
82
|
+
langfun/core/eval/v2/runners.py,sha256=iqbH4jMtnNMhfuv1eHaxJmk1Vvsrz-sAJJFP8U44-tA,16758
|
83
|
+
langfun/core/eval/v2/runners_test.py,sha256=DO3xV0sBNB6n65j41xx2i7gqUCJcPF37DFZLEjrmISg,11987
|
84
84
|
langfun/core/llms/__init__.py,sha256=QWxRhzVn_vgJvdmW_xs5PcPuDbHsUxTU94YyV4Ofl34,8684
|
85
85
|
langfun/core/llms/anthropic.py,sha256=qaclpfX3qeHoZMDxU3Gn-638Vi4IyCbxdow3zgGUHK4,22195
|
86
86
|
langfun/core/llms/anthropic_test.py,sha256=dFnNvrgwCYUseDuiuWCBoQ5jloYX9RIlZQf7cCLPNU4,8282
|
@@ -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.dev202505080804.dist-info/licenses/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
160
|
+
langfun-0.1.2.dev202505080804.dist-info/METADATA,sha256=CAqwJ8wOEhPMNBg-5-9XUOB8qWL3wuZJkycpxgcKugg,8178
|
161
|
+
langfun-0.1.2.dev202505080804.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
162
|
+
langfun-0.1.2.dev202505080804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
|
163
|
+
langfun-0.1.2.dev202505080804.dist-info/RECORD,,
|
File without changes
|
{langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{langfun-0.1.2.dev202505070805.dist-info → langfun-0.1.2.dev202505080804.dist-info}/top_level.txt
RENAMED
File without changes
|