tfm.core.train_utils.BestCheckpointExporter

Keeps track of the best result, and saves its checkpoint.

Orbit will support an API for checkpoint exporter. This class will be used together with orbit once this functionality is ready.

export_dir The directory that will contain exported checkpoints.
metric_name Indicates which metric to look at, when determining which result is better. If eval_logs being passed to maybe_export_checkpoint is a nested dictionary, use | as a seperator for different layers.
metric_comp Indicates how to compare results. Either lower or higher.

best_ckpt_logs

best_ckpt_logs_path

best_ckpt_path Returns the best ckpt path or None if there is no ckpt yet.

Methods

export_best_eval_metric

View source

Export evaluation results of the best checkpoint into a json file.

maybe_export_checkpoint

View source

Compare eval_logs with past eval_logs and export checkpoint if better.