code: def build_num_microbatches_calculator(args):
      # Constant num micro-batches.
      if args.rampup_batch_size is None:
          num_microbatches_calculator = ConstantNumMicroBatches(
              args.global_batch_size,
              args.micro_batch_size,
              args.data_parallel_size,
          )
          if args.rank == 0:
              print(
                  "setting number of micro-batches to constant {}".format(
                      num_microbatches_calculator.get()
                  ),
                  flush=True,
              )
  
      else:
          assert len(args.rampup_batch_size) == 3, (
              "expected the following "
              "format: --rampup-batch-size <start batch size> "
              "<batch size incerement> <ramp-up samples>"
          )
          start_batch_size = int(args.rampup_batch_size[0])
          batch_size_increment = int(args.rampup_batch_size[1])
          ramup_samples = int(args.rampup_batch_size[2])
          if args.rank == 0:
              print(
                  "will use batch size rampup starting from global batch "
                  "size {} to global batch size {} with batch size increments "
                  "{} over {} samples.".format(
                      start_batch_size,
                      args.global_batch_size,
                      batch_size_increment,
                      ramup_samples,
                  ),
                  flush=True,
              )
          num_microbatches_calculator = RampupBatchsizeNumMicroBatches(
              start_batch_size,
              batch_size_increment,
              ramup_samples,
              args.global_batch_size,
              args.micro_batch_size,
              args.data_parallel_size,
          )
  
      return num_microbatches_calculator
  
file_path: megatron-lm/megatron/microbatches.py
imports: from abc import ABC
  from abc import abstractmethod
label_desc: Use image node_id 1 for calling a global function with example usage: build_num_microbatches_calculator(args) and returns: num_microbatches_calculator