def reduce_metrics(logging_outputs) -> None:
        """Aggregate logging outputs from data parallel training."""
        loss_sum = sum(log.get("loss", 0) for log in logging_outputs)
        metric_sum = sum(log.get("metric", 0) for log in logging_outputs)
        nsentences = sum(log.get("nsentences", 0) for log in logging_outputs)
        ntokens = sum(log.get("ntokens", 0) for log in logging_outputs)
        metrics.log_scalar(
            "loss", loss_sum / ntokens, ntokens, round=3
        )
        metrics.log_scalar(
            "metric", metric_sum / nsentences, nsentences, round=3
        )
Aggregate logging outputs from data parallel training.
YOCO/yoco/criterions/needle_haystack.py