code: def default_parse_config_tokenizer_model_kwargs(
      hparams: Union[Dict, utils.AttrDict],
  ) -> Tuple[utils.AttrDict, utils.AttrDict, utils.AttrDict]:
      """
      This function converts hparams into fields for the transformers config, tokenizer,
      and model. See the defined dataclasses ConfigKwargs, TokenizerKwargs, and ModelKwargs for
      expected fields and defaults.
  
      Args:
          hparams: hyperparameters to parse.
  
      Returns:
          One AttrDict each for the config, tokenizer, and model.
      """
      if not isinstance(hparams, utils.AttrDict):
          hparams = utils.AttrDict(hparams)
      (
          config_args,
          tokenizer_args,
          model_args,
      ) = parse_dict_to_dataclasses(
          (ConfigKwargs, TokenizerKwargs, ModelKwargs),
          hparams,
          as_dict=True,
      )
  
      # If a pretrained_model_name_or_path is provided it will be parsed to the
      # arguments for config, tokenizer, and model.  Then, if specific names are
      # provided for config, tokenizer, or model we will override it.
      if "config_name" in hparams:
          config_args.pretrained_model_name_or_path = (
              hparams.config_name
          )
      if "tokenizer_name" in hparams:
          tokenizer_args.pretrained_model_name_or_path = (
              hparams.tokenizer_name
          )
      if "model_name" in hparams:
          model_args.pretrained_model_name_or_path = hparams.model_name
      assert (
          config_args.pretrained_model_name_or_path is not None
          and tokenizer_args.pretrained_model_name_or_path is not None
          and model_args.pretrained_model_name_or_path is not None
      )
      return config_args, tokenizer_args, model_args
  
file_path: determined/model_hub/model_hub/huggingface/_config_parser.py
imports: import dataclasses
  from typing import Any, Dict, Optional, Tuple, Union
  from model_hub import utils
label_desc: Use image node_id 2 for calling a global function with example usage: default_parse_config_tokenizer_model_kwargs(hparams) and returns: config_args,  tokenizer_args,  model_args