class_docstr: The ``HfTrainerDeepSpeedConfig`` object is meant to be created during ``TrainingArguments`` object creation and has
  the same lifespan as the latter.
class_docstr_tok: ["The","``","HfTrainerDeepSpeedConfig","``","object","is","meant","to","be","created","during","``","TrainingArguments","``","object","creation","and","has","the","same","lifespan","as","the","latter","."]
docstr: Adjust the config with ``TrainingArguments`` values. This stage is run during ``TrainingArguments`` object
  creation.
docstr_tok: ["Adjust","the","config","with","``","TrainingArguments","``","values",".","This","stage","is","run","during","``","TrainingArguments","``","object","creation","."]
code: def trainer_config_process(self, args):
      """
      Adjust the config with ``TrainingArguments`` values. This stage is run during ``TrainingArguments`` object
      creation.
      """
      # DeepSpeed does:
      # train_batch_size = world_size * train_micro_batch_size_per_gpu * gradient_accumulation_steps
      train_batch_size = (
          args.world_size
          * args.per_device_train_batch_size
          * args.gradient_accumulation_steps
      )
      self.fill_match(
          "train_micro_batch_size_per_gpu",
          args.per_device_train_batch_size,
          "per_device_train_batch_size",
      )
      self.fill_match(
          "gradient_accumulation_steps",
          args.gradient_accumulation_steps,
          "gradient_accumulation_steps",
      )
      self.fill_match(
          "train_batch_size",
          train_batch_size,
          "train_batch_size (calculated)",
      )
      self.fill_match(
          "gradient_clipping", args.max_grad_norm, "max_grad_norm"
      )
  
      self.fill_match(
          "optimizer.params.lr", args.learning_rate, "learning_rate"
      )
      self.fill_match(
          "optimizer.params.betas",
          [args.adam_beta1, args.adam_beta2],
          "adam_beta1+adam_beta2",
      )
      self.fill_match(
          "optimizer.params.eps", args.adam_epsilon, "adam_epsilon"
      )
      self.fill_match(
          "optimizer.params.weight_decay",
          args.weight_decay,
          "weight_decay",
      )
  
      self.fill_only(
          "scheduler.params.warmup_min_lr", 0
      )  # not a trainer arg
      self.fill_match(
          "scheduler.params.warmup_max_lr",
          args.learning_rate,
          "learning_rate",
      )
      # total_num_steps - will get set in trainer_config_finalize
  
      # fp16
      if args.fp16:
          fp16_backend = (
              "apex" if args.fp16_backend == "apex" else "amp"
          )
      else:
          fp16_backend = None
  
      # amp: similar to the pytorch native amp - it has a bunch of optional params but we won't set
      # any here unless the user did the work
      self.fill_match(
          "fp16.enabled",
          fp16_backend == "amp",
          "fp16+fp16_backend(amp)",
      )
  
      # apex: delegates amp work to apex (which needs to be available), but it cannot be used with any
      # ZeRO features
      self.fill_match(
          "amp.enabled",
          fp16_backend == "apex",
          "fp16+fp16_backend(apex)",
      )
      self.fill_match(
          "amp.opt_level", args.fp16_opt_level, "fp16_opt_level"
      )
  
      # only if we have an explicit fp16.enabled = False then it's fp32, if it's True or this
      # whole config section is missing then the fallback is fp16
      if self.is_false("fp16.enabled"):
          self._dtype = torch.float32
  
imports: import importlib.util
  import io
  import json
  import weakref
  from copy import deepcopy
  from functools import partialmethod
  from .utils.versions import require_version
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.core.log import logger
label_desc: Use image node_id 4 for calling the HfTrainerDeepSpeedConfig obj's underlying member method code with example usage: obj.trainer_config_process(args) without return types