Skip to content

Commit

Permalink
Add metrics as metadata to checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragjn committed Dec 10, 2023
1 parent 62038e1 commit 7c65329
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mlfoundry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,14 @@ def on_save(self, args, state, control, **kwargs):
if TFY_INTERNAL_JOB_NAME:
description = f"Checkpoint from finetuning job={TFY_INTERNAL_JOB_NAME} run={TFY_INTERNAL_JOB_RUN_NAME}"
logger.info(f"Uploading checkpoint {ckpt_dir} ...")
metadata = {}
for log in state.log_history:
if isinstance(log, dict) and log.get("step") == state.global_step:
metadata = log.copy()
self._run.log_artifact(
name=self._checkpoint_artifact_name,
artifact_paths=[(artifact_path,)],
metadata=metadata,
step=state.global_step,
description=description,
)

0 comments on commit 7c65329

Please sign in to comment.