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: This stage is run after we have the model and know num_training_steps.
  
  Now we we can complete the configuration process.
docstr_tok: ["This","stage","is","run","after","we","have","the","model","and","know","num_training_steps",".","Now","we","we","can","complete","the","configuration","process","."]
code: def trainer_config_finalize(self, args, model, num_training_steps):
      """
      This stage is run after we have the model and know num_training_steps.
  
      Now we we can complete the configuration process.
      """
      # zero
      if self.is_zero3():
          # automatically assign the optimal config values based on model config
          hidden_size = model.config.hidden_size
          self.fill_only(
              "zero_optimization.reduce_bucket_size",
              hidden_size * hidden_size,
          )
          self.fill_only(
              "zero_optimization.stage3_prefetch_bucket_size",
              0.9 * hidden_size * hidden_size,
          )
          self.fill_only(
              "zero_optimization.stage3_param_persistence_threshold",
              10 * hidden_size,
          )
  
      # scheduler
      self.fill_match(
          "scheduler.params.total_num_steps",
          num_training_steps,
          "num_training_steps (calculated)",
      )
      self.fill_match(
          "scheduler.params.warmup_num_steps",
          args.get_warmup_steps(num_training_steps),
          "warmup_steps",
      )
  
      if len(self.mismatches) > 0:
          mismatches = "\n".join(self.mismatches)
          raise ValueError(
              f"Please correct the following DeepSpeed config values that mismatch TrainingArguments values:\n{mismatches}\n"
              "The easiest method is to set these DeepSpeed config values to 'auto'."
          )
  
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 5 for calling the HfTrainerDeepSpeedConfig obj's underlying member method code with example usage: obj.trainer_config_finalize(args, model, num_training_steps) without return types