code: def __call__(
      self,
      global_step: int,
      loss: AverageMeter,
      epoch: int,
      fp16: bool,
      learning_rate: float,
      grad_scaler: torch.cuda.amp.GradScaler,
  ):
      if (
          self.rank == 0
          and global_step > 0
          and global_step % self.frequent == 0
      ):
          if self.init:
              try:
                  speed: float = (
                      self.frequent
                      * self.batch_size
                      / (time.time() - self.tic)
                  )
                  speed_total = speed * self.world_size
              except ZeroDivisionError:
                  speed_total = float("inf")
  
              # time_now = (time.time() - self.time_start) / 3600
              # time_total = time_now / ((global_step + 1) / self.total_step)
              # time_for_end = time_total - time_now
              time_now = time.time()
              time_sec = int(time_now - self.time_start)
              time_sec_avg = time_sec / (
                  global_step - self.start_step + 1
              )
              eta_sec = time_sec_avg * (
                  self.total_step - global_step - 1
              )
              time_for_end = eta_sec / 3600
              if self.writer is not None:
                  self.writer.add_scalar(
                      "time_for_end", time_for_end, global_step
                  )
                  self.writer.add_scalar(
                      "learning_rate", learning_rate, global_step
                  )
                  self.writer.add_scalar("loss", loss.avg, global_step)
              if fp16:
                  msg = (
                      "Speed %.2f samples/sec   Loss %.4f   LearningRate %.6f   Epoch: %d   Global Step: %d   "
                      "Fp16 Grad Scale: %2.f   Required: %1.f hours"
                      % (
                          speed_total,
                          loss.avg,
                          learning_rate,
                          epoch,
                          global_step,
                          grad_scaler.get_scale(),
                          time_for_end,
                      )
                  )
              else:
                  msg = (
                      "Speed %.2f samples/sec   Loss %.4f   LearningRate %.6f   Epoch: %d   Global Step: %d   "
                      "Required: %1.f hours"
                      % (
                          speed_total,
                          loss.avg,
                          learning_rate,
                          epoch,
                          global_step,
                          time_for_end,
                      )
                  )
              logging.info(msg)
              loss.reset()
              self.tic = time.time()
          else:
              self.init = True
              self.tic = time.time()
  
file_path: insightface/recognition/arcface_torch/utils/utils_callbacks.py
imports: import logging
  import os
  import time
  from typing import List
  import torch
  from eval import verification
  from utils.utils_logging import AverageMeter
  from torch.utils.tensorboard import SummaryWriter
  from torch import distributed
label_desc: Use image node_id 2 for calling the CallBackLogging obj's underlying member method code with example usage: obj.__call__(global_step, loss, epoch, fp16, learning_rate, grad_scaler) without return types