Unverified Commit 8b325781 authored by Walter Martin's avatar Walter Martin Committed by GitHub
Browse files

improving efficiency of mlflow metric logging (#14232)


Signed-off-by: default avatarWalter Martin <wamartin@microsoft.com>
parent ce91bf9a
......@@ -726,9 +726,10 @@ class MLflowCallback(TrainerCallback):
if not self._initialized:
self.setup(args, state, model)
if state.is_world_process_zero:
metrics = {}
for k, v in logs.items():
if isinstance(v, (int, float)):
self._ml_flow.log_metric(k, v, step=state.global_step)
metrics[k] = v
else:
logger.warning(
f"Trainer is attempting to log a value of "
......@@ -736,6 +737,7 @@ class MLflowCallback(TrainerCallback):
f"MLflow's log_metric() only accepts float and "
f"int types so we dropped this attribute."
)
self._ml_flow.log_metrics(metrics=metrics, step=state.global_step)
def on_train_end(self, args, state, control, **kwargs):
if self._initialized and state.is_world_process_zero:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment