Skip to content

Commit

Permalink
Add warning when GCS checkpoint is missing commit_success.txt (in cas…
Browse files Browse the repository at this point in the history
…e the checkpoint comes from not GCS originally).

PiperOrigin-RevId: 658176355
  • Loading branch information
rdyro authored and Orbax Authors committed Jul 31, 2024
1 parent 3cc343c commit 51a767c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions checkpoint/orbax/checkpoint/path/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import re
import time
from typing import Callable, Generic, Iterator, List, Optional, Protocol, Sequence, Set, TypeVar
import warnings

from absl import logging
from etils import epath
Expand Down Expand Up @@ -540,6 +541,11 @@ def is_checkpoint_finalized(path: epath.PathLike) -> bool:
if not path.is_dir():
raise ValueError(f'Path {path} is not a directory. Not a valid checkpoint')
if is_gcs_path(path) and not (path / _COMMIT_SUCCESS_FILE).exists():
warnings.warn(
f'This GCS path {path} does not contain the'
f' {_COMMIT_SUCCESS_FILE} file indicating successfully'
' written GCS checkpoint.'
)
return False
if TMP_DIR_SUFFIX in path.name:
return False
Expand Down

0 comments on commit 51a767c

Please sign in to comment.