    def update_metrics(self, model: nn.Module, inputs: Any, step_loss: torch.Tensor, training: bool = True) -> tuple:
        """
        Update the loss and metric in one epoch.
        When restart a new epoch, the epoch_loss and epoch metric will be clear.

        Args:
            model (`nn.Module`):
                Pytorch model.
            inputs (`Any`):
                Torch tensor or any kind of collection made up by tensors.
            step_loss (`torch.Tensor`):
                One batch step loss.
            training (`bool`):
                Whether it's training mode now.

        Returns:
            (`tuple`)
                Epoch loss and epoch metric.
        """
        self.loss_metric.update(send_to_device(step_loss, self.configs.device))
        loss_metric = self.loss_metric.compute().item()
        if self.configs.eval_strategy == "eval_epoch" and training:
            epoch_metric = 0
        else:
            epoch_metric = self.compute_metric(model, inputs)
        return loss_metric, epoch_metric
Update the loss and metric in one epoch.
When restart a new epoch, the epoch_loss and epoch metric will be clear.

Args:
model (`nn.Module`):
Pytorch model.
inputs (`Any`):
Torch tensor or any kind of collection made up by tensors.
step_loss (`torch.Tensor`):
One batch step loss.
training (`bool`):
Whether it's training mode now.

Returns:
(`tuple`)
Epoch loss and epoch metric.
towhee/trainer/trainer.py