code: def get_batch_config_from_mbs_gas_and_slots(
      ds_config: Dict[str, Any], slots: int
  ) -> Dict[str, int]:
      """
      Returns a consistent batch size configuration by adjusting `train_batch_size` according to the
      number of `slots`, `train_micro_batch_size_per_gpu`, and `gradient_accumulation_steps`  (or its
      default value, if not specified).
      """
      mbs = ds_config["train_micro_batch_size_per_gpu"]
      gas = ds_config.get(
          "gradient_accumulation_steps", _defaults.GAS_DEFAULT
      )
      if gas == "auto":
          # Needed for HuggingFace.
          gas = 1
      tbs = mbs * gas * slots
      return {
          "train_batch_size": tbs,
          "train_micro_batch_size_per_gpu": mbs,
          "gradient_accumulation_steps": gas,
      }
  
imports: import argparse
  import copy
  import json
  import logging
  import pathlib
  import random
  from contextlib import contextmanager
  from typing import Any, Dict, Generator, List, Optional, Union
  import filelock
  import torch
  import determined
  from determined.common import util
  from determined.pytorch.dsat import _defaults
  from determined.util import merge_dicts
label_desc: Use image node_id 11 for calling a global function with example usage: get_batch_config_from_mbs_gas_and_slots(ds_config, slots) and returns: dict