docstr: The main loop for a dynamic batching process.
docstr_tok: ["The","main","loop","for","a","dynamic","batching","process","."]
code: def loop_for_fwd(self):
      """
      The main loop for a dynamic batching process.
      """
      counter_count = 0
      # self.running_batch is not None or self.req_queue.waiting_req_list
      while (
          self.running_batch is not None
          or self.req_queue.waiting_req_list
      ):
          yield from self._step()
          counter_count += 1
          if self.running_batch is not None:
              if counter_count % self.mem_usage_interval == 0:
                  print(
                      "current batch size:",
                      len(self.running_batch.reqs),
                      "token used ratio:",
                      self.running_batch.calcu_used_tokens()
                      / self.max_total_token_num,
                  )
              self.stats_tool.print_stats()
  
          if self.running_batch is None:
              time.sleep(0.1)
  
imports: import time
  from typing import List
  from .dynamic_batching.get_tokenizer import get_tokenizer
  from .dynamic_batching.infer_batch import InferBatch
  from .dynamic_batching.io_struct import Batch, Req
  from .dynamic_batching.req_queue import ReqQueue
  from .dynamic_batching.sampling_params import SamplingParams
  from .dynamic_batching.stats import Stats
  from .tensor_parallel import TPInferEngine
label_desc: Use image node_id 5 for calling the DynamicBatchManager obj's underlying member method code with example usage: obj.loop_for_fwd() without return types