mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
improving efficiency of mlflow metric logging (#14232)
Signed-off-by: Walter Martin <wamartin@microsoft.com>
This commit is contained in:
parent
ce91bf9a34
commit
8b32578119
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user