code: def log_every(
      self,
      iterable,
      print_freq,
      header=None,
      n_iterations=None,
      start_iteration=0,
  ):
      i = start_iteration
      if not header:
          header = ""
      start_time = time.time()
      end = time.time()
      iter_time = SmoothedValue(fmt="{avg:.6f}")
      data_time = SmoothedValue(fmt="{avg:.6f}")
  
      if n_iterations is None:
          n_iterations = len(iterable)
  
      space_fmt = ":" + str(len(str(n_iterations))) + "d"
  
      log_list = [
          header,
          "[{0" + space_fmt + "}/{1}]",
          "eta: {eta}",
          "{meters}",
          "time: {time}",
          "data: {data}",
      ]
      if torch.cuda.is_available():
          log_list += ["max mem: {memory:.0f}"]
  
      log_msg = self.delimiter.join(log_list)
      MB = 1024.0 * 1024.0
      for obj in iterable:
          data_time.update(time.time() - end)
          yield obj
          iter_time.update(time.time() - end)
          if i % print_freq == 0 or i == n_iterations - 1:
              self.dump_in_output_file(
                  iteration=i,
                  iter_time=iter_time.avg,
                  data_time=data_time.avg,
              )
              eta_seconds = iter_time.global_avg * (n_iterations - i)
              eta_string = str(
                  datetime.timedelta(seconds=int(eta_seconds))
              )
              if torch.cuda.is_available():
                  logger.info(
                      log_msg.format(
                          i,
                          n_iterations,
                          eta=eta_string,
                          meters=str(self),
                          time=str(iter_time),
                          data=str(data_time),
                          memory=torch.cuda.max_memory_allocated() / MB,
                      )
                  )
              else:
                  logger.info(
                      log_msg.format(
                          i,
                          n_iterations,
                          eta=eta_string,
                          meters=str(self),
                          time=str(iter_time),
                          data=str(data_time),
                      )
                  )
          i += 1
          end = time.time()
          if i >= n_iterations:
              break
      total_time = time.time() - start_time
      total_time_str = str(datetime.timedelta(seconds=int(total_time)))
      logger.info(
          "{} Total time: {} ({:.6f} s / it)".format(
              header, total_time_str, total_time / n_iterations
          )
      )
  
imports: from collections import defaultdict, deque
  import datetime
  import json
  import logging
  import time
  import torch
  import dinov2.distributed
label_desc: Use image node_id 8 for calling the MetricLogger obj's underlying member method code with example usage: obj.log_every(iterable, print_freq, header, n_iterations, start_iteration) without return types