Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion t5x/checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ def best_fn(metrics):
max_to_keep=keep,
save_interval_steps=period,
keep_period=force_keep_period,
best_fn=best_fn if metric_name_to_monitor is not None else None,
get_metric_fn=best_fn if metric_name_to_monitor is not None else None,
best_mode=metric_mode,
keep_checkpoints_without_metrics=keep_checkpoints_without_metrics,
cleanup_tmp_directories=True,
Expand Down
6 changes: 3 additions & 3 deletions t5x/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ def test_create_orbax_checkpoint_manager(
expected_keep_checkpoints_without_metrics,
)
if expected_metric is None:
self.assertIsNone(manager._manager._options.best_fn)
self.assertIsNone(manager._manager._options.get_metric_fn)
else:
self.assertEqual(
manager._manager._options.best_fn(metrics),
manager._manager._options.get_metric_fn(metrics),
expected_metric,
)

Expand Down Expand Up @@ -812,7 +812,7 @@ def test_create_orbax_checkpoint_manager_from_checkpointer(
self.assertEqual(manager._manager._options.best_mode, "max")
self.assertTrue(manager._manager._options.keep_checkpoints_without_metrics)
self.assertEqual(
manager._manager._options.best_fn(
manager._manager._options.get_metric_fn(
{"train/accuracy": 0.8, "train/loss": 0.1}
),
0.8,
Expand Down
Loading