Skip to content

Commit

Permalink
Removal of metrics deepcopy before computing the metrics (mosaicml#3180)
Browse files Browse the repository at this point in the history
* remove deepcopy of metrics before calling metric.compute()

* update documentation of _compute_and_log_metrics

---------

Co-authored-by: Grégoire Jauvion <[email protected]>
Co-authored-by: Mihir Patel <[email protected]>
  • Loading branch information
3 people authored and DhruvDh committed Apr 21, 2024
1 parent 70d54de commit 3ba290b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions composer/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2246,14 +2246,12 @@ def _ensure_metrics_device_and_dtype(
return metrics

def _compute_and_log_metrics(self, dataloader_label: str, metrics: Dict[str, Metric]):
"""Computes metrics, logs the results, and updates the state with the deep-copied metrics.
"""Computes metrics, logs the results, and updates the state with the metrics.
Args:
dataloader_label (str): The dataloader label.
metrics (Dict[str, Metric]): The metrics to compute.
"""
metrics = deepcopy(metrics)

# log computed metrics
computed_metrics = {}
for metric_name, metric in metrics.items():
Expand Down

0 comments on commit 3ba290b

Please sign in to comment.