class_docstr: A wrapper of fairseq data iterator, usage:
  batch_itr = BatchIterator(fairseq_args, fairseq_task)
  for epoch in batch_itr.train_epoch():
      for batch in batch_itr.train_batch():
          train(batch)
          if should_valid():
              for sub in batch_itr.valid_dataset():
                  for sample in batch_itr.valid_batch():
                      valid(sample)
                  pirnt(f"Finish valid {sub}")
      print(f"Finish train epoch {epoch}")
code: def train_epoch(self):
      args, task = self.args, self.task
      epoch = 1  # epoch of fairseq starts from 1
      max_epoch = args.max_epoch or math.inf
      while epoch < max_epoch:
          self._train_epoch(epoch)
          yield epoch
          epoch += 1
  
file_path: lightseq/examples/training/deepspeed/ds_fairseq_data.py
imports: import math
  import logging
  import torch.distributed
  from fairseq import utils
label_desc: Use image node_id 5 for calling the BatchIterator obj's underlying member method code with example usage: obj.train_epoch() without return types