Skip to content

Commit d048f59

Browse files
abhishek002002t5-copybara
authored andcommitted
Rename best_fn to get_metric_fn in CheckpointManagerOptions.
PiperOrigin-RevId: 750499978
1 parent 509d35e commit d048f59

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

t5x/checkpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ def best_fn(metrics):
22852285
max_to_keep=keep,
22862286
save_interval_steps=period,
22872287
keep_period=force_keep_period,
2288-
best_fn=best_fn if metric_name_to_monitor is not None else None,
2288+
get_metric_fn=best_fn if metric_name_to_monitor is not None else None,
22892289
best_mode=metric_mode,
22902290
keep_checkpoints_without_metrics=keep_checkpoints_without_metrics,
22912291
cleanup_tmp_directories=True,

t5x/utils_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,10 @@ def test_create_orbax_checkpoint_manager(
742742
expected_keep_checkpoints_without_metrics,
743743
)
744744
if expected_metric is None:
745-
self.assertIsNone(manager._manager._options.best_fn)
745+
self.assertIsNone(manager._manager._options.get_metric_fn)
746746
else:
747747
self.assertEqual(
748-
manager._manager._options.best_fn(metrics),
748+
manager._manager._options.get_metric_fn(metrics),
749749
expected_metric,
750750
)
751751

@@ -812,7 +812,7 @@ def test_create_orbax_checkpoint_manager_from_checkpointer(
812812
self.assertEqual(manager._manager._options.best_mode, "max")
813813
self.assertTrue(manager._manager._options.keep_checkpoints_without_metrics)
814814
self.assertEqual(
815-
manager._manager._options.best_fn(
815+
manager._manager._options.get_metric_fn(
816816
{"train/accuracy": 0.8, "train/loss": 0.1}
817817
),
818818
0.8,

0 commit comments

Comments
 (0)