Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 691549644
  • Loading branch information
niketkumar authored and Orbax Authors committed Oct 30, 2024
1 parent 712c7c7 commit 804e803
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions checkpoint/orbax/checkpoint/path/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,12 @@ def latest_step_metadata(
root_path: epath.PathLike, name_format: NameFormat[MetadataT]
) -> Optional[MetadataT]:
"""Returns step.MetadataT of the latest step in `root_path`."""
root_path = epath.Path(root_path)
return max(
name_format.find_all(root_path),
sorted(
name_format.find_all(root_path),
key=lambda metadata: metadata.path.name,
reverse=True,
),
default=None,
key=lambda metadata: metadata.step,
)
Expand Down

0 comments on commit 804e803

Please sign in to comment.