code: def update_train_iters(args):
      # For iteration-based training, we don't need to do anything
      if args.train_iters:
          return
  
      # Constant batch size with sample-based training.
      if args.rampup_batch_size is None:
          args.train_iters = (
              args.train_samples // args.global_batch_size
          )
  
      else:
          # Sample based training with rampup batch size.
          iterations = 0
          consumed_samples = 0
          # Rampup phase.
          while consumed_samples <= int(args.rampup_batch_size[2]):
              update_num_microbatches(
                  consumed_samples, consistency_check=False
              )
              consumed_samples += get_current_global_batch_size()
              iterations += 1
          # Reset
          update_num_microbatches(0, consistency_check=False)
          # Constant phase
          # Note that we throw away any partial last batch.
          iterations += (
              args.train_samples - consumed_samples
          ) // args.global_batch_size
          args.train_iters = iterations
  
      print_rank_0(
          "setting training iterations to {}".format(args.train_iters)
      )
  
imports: import gc
  from datetime import datetime
  import math
  import logging
  import sys
  from .log_handler import CustomHandler
  from .theoretical_memory_usage import report_theoretical_memory
  import time
  import torch
  from megatron import get_args
  from megatron import get_signal_handler
  from megatron import get_timers
  from megatron import get_tensorboard_writer
  from megatron import get_wandb_writer
  from megatron import get_current_global_batch_size
  from megatron import get_num_microbatches
  from megatron import is_last_rank
  from megatron import update_num_microbatches
  from megatron.core import mpu, tensor_parallel
  from megatron.core.utils import get_model_config
  from megatron import print_rank_0
  from megatron import print_rank_last
  from megatron.checkpointing import load_checkpoint
  from megatron.checkpointing import save_checkpoint
  from megatron.model import Float16Module
  from megatron.model import GPTModel
  from megatron.core.distributed import DistributedDataParallel
  from megatron.core.distributed import finalize_model_grads
  from megatron.core.enums import ModelType
  from megatron.optimizer import get_megatron_optimizer
  from megatron.initialize import initialize_megatron
  from megatron.initialize import write_args_to_tensorboard
  from megatron.initialize import set_jit_fusion_options
  from megatron.optimizer_param_scheduler import OptimizerParamScheduler
  from megatron.utils import check_adlr_autoresume_termination
  from megatron.utils import unwrap_model
  from megatron.data.data_samplers import build_pretraining_data_loader
  from megatron.utils import calc_params_l2_norm
  from megatron.core.pipeline_parallel import get_forward_backward_func
  from megatron.utils import report_memory
  from megatron.model.vision.knn_monitor import compute_feature_bank
label_desc: Use image node_id 4 for calling a global function with example usage: update_train_iters(args) without return types