A CheckpointManager that also exports SavedModels.

checkpoint Returns the tf.train.Checkpoint object.

checkpoints A list of managed checkpoints.

Note that checkpoints saved due to keep_checkpoint_every_n_hours will not show up in this list (to avoid ever-growing filename lists).


latest_checkpoint The prefix of the most recent checkpoint in directory.

Equivalent to tf.train.latest_checkpoint(directory) where directory is the constructor argument to CheckpointManager.

Suitable for passing to tf.train.Checkpoint.restore to resume training.

latest_savedmodel The path of the most recent SavedModel in directory.

savedmodels A list of managed SavedModels.



View source

Gets a list of all existing SavedModel paths in directory.

A list of all existing SavedModel paths.


View source

Gets the savedmodel_number/checkpoint_number from savedmodel filepath.

The savedmodel_number is global step when using with orbit controller.

savedmodel_path savedmodel directory path.

Savedmodel number or None if no matched pattern found in savedmodel path.


Restore items in checkpoint from the latest checkpoint file.

This method will first try to restore from the most recent checkpoint in directory. If no checkpoints exist in directory, and init_fn is specified, this method will call init_fn to do customized initialization. This can be used to support initialization from pretrained models.

Note that unlike tf.train.Checkpoint.restore(), this method doesn't return a load status object that users can run assertions on (e.g. assert_consumed()). Thus to run assertions, users should directly use tf.train.Checkpoint.restore() method.

The restored checkpoint path if the lastest checkpoint is found and restored. Otherwise None.


View source

See base class.


View source

Continuously yield new SavedModel files as they appear.

The iterator only checks for new savedmodels when control flow has been reverted to it. The logic is same to the train.checkpoints_iterator.

min_interval_secs The minimum number of seconds between yielding savedmodels.
timeout The maximum number of seconds to wait between savedmodels. If left as None, then the process will wait indefinitely.
timeout_fn Optional function to call after a timeout. If the function returns True, then it means that no new savedmodels will be generated and the iterator will exit. The function is called with no arguments.

String paths to latest SavedModel files as they arrive.


Wait for any outstanding save or restore operations.


View source

Waits until a new savedmodel file is found.

last_savedmodel The last savedmodel path used or None if we're expecting a savedmodel for the first time.
seconds_to_sleep The number of seconds to sleep for before looking for a new savedmodel.
timeout The maximum number of seconds to wait. If left as None, then the process will wait indefinitely.

A new savedmodel path, or None if the timeout was reached.