class_docstr: Base class for configuration classes that need to respect the same API than PretrainedConfig but with a different
  configuration file name.
class_docstr_tok: ["Base","class","for","configuration","classes","that","need","to","respect","the","same","API","than","PretrainedConfig","but","with","a","different","configuration","file","name","."]
code: def _get_config_dict(
      cls,
      pretrained_model_name_or_path: Union[str, os.PathLike],
      **kwargs,
  ) -> Tuple[Dict[str, Any], Dict[str, Any]]:
      cache_dir = kwargs.pop("cache_dir", None)
      force_download = kwargs.pop("force_download", False)
      resume_download = kwargs.pop("resume_download", False)
      proxies = kwargs.pop("proxies", None)
      use_auth_token = kwargs.pop("use_auth_token", None)
      local_files_only = kwargs.pop("local_files_only", False)
      revision = kwargs.pop("revision", None)
      trust_remote_code = kwargs.pop("trust_remote_code", None)
      subfolder = kwargs.pop("subfolder", "")
      from_pipeline = kwargs.pop("_from_pipeline", None)
      from_auto_class = kwargs.pop("_from_auto", False)
      commit_hash = kwargs.pop("_commit_hash", None)
  
      if trust_remote_code is True:
          logger.warning(
              "The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is"
              " ignored."
          )
  
      user_agent = {
          "file_type": "config",
          "from_auto_class": from_auto_class,
      }
      if from_pipeline is not None:
          user_agent["using_pipeline"] = from_pipeline
  
      pretrained_model_name_or_path = str(pretrained_model_name_or_path)
  
      is_local = os.path.isdir(pretrained_model_name_or_path)
      if os.path.isfile(
          os.path.join(subfolder, pretrained_model_name_or_path)
      ):
          # Special case when pretrained_model_name_or_path is a local file
          resolved_config_file = pretrained_model_name_or_path
          is_local = True
      # TODO: remove once transformers release version is way above 4.22.
      elif _transformers_version_is_below_threshold and os.path.isdir(
          pretrained_model_name_or_path
      ):
          configuration_file = kwargs.pop(
              "_configuration_file", cls.CONFIG_NAME
          )
          resolved_config_file = os.path.join(
              pretrained_model_name_or_path, configuration_file
          )
          if not os.path.isfile(resolved_config_file):
              raise EnvironmentError(
                  f"Could not locate {configuration_file} inside {pretrained_model_name_or_path}."
              )
      # TODO: remove condition once transformers release version is way above 4.22.
      elif (
          not _transformers_version_is_below_threshold
          and is_remote_url(pretrained_model_name_or_path)
      ):
          configuration_file = pretrained_model_name_or_path
          resolved_config_file = download_url(
              pretrained_model_name_or_path
          )
      else:
          configuration_file = kwargs.pop(
              "_configuration_file", cls.CONFIG_NAME
          )
  
          try:
              # TODO: remove once transformers release version is way above 4.22.
              if _transformers_version_is_below_threshold:
                  config_file = hf_bucket_url(
                      pretrained_model_name_or_path,
                      filename=configuration_file,
                      revision=revision,
                      subfolder=subfolder
                      if len(subfolder) > 0
                      else None,
                      mirror=None,
                  )
                  # Load from URL or cache if already cached
                  resolved_config_file = cached_path(
                      config_file,
                      cache_dir=cache_dir,
                      force_download=force_download,
                      proxies=proxies,
                      resume_download=resume_download,
                      local_files_only=local_files_only,
                      use_auth_token=use_auth_token,
                      user_agent=user_agent,
                  )
              else:
                  # Load from local folder or from cache or download from model Hub and cache
                  resolved_config_file = cached_file(
                      pretrained_model_name_or_path,
                      configuration_file,
                      cache_dir=cache_dir,
                      force_download=force_download,
                      proxies=proxies,
                      resume_download=resume_download,
                      local_files_only=local_files_only,
                      use_auth_token=use_auth_token,
                      user_agent=user_agent,
                      revision=revision,
                      subfolder=subfolder,
                      _commit_hash=commit_hash,
                  )
                  commit_hash = extract_commit_hash(
                      resolved_config_file, commit_hash
                  )
          except EnvironmentError:
              # Raise any environment error raise by `cached_file`. It will have a helpful error message adapted to
              # the original exception.
              raise
          except Exception:
              # For any other exception, we throw a generic error.
              raise EnvironmentError(
                  f"Can't load the configuration of '{pretrained_model_name_or_path}'. If you were trying to load it"
                  " from 'https://huggingface.co/models', make sure you don't have a local directory with the same"
                  f" name. Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory"
                  f" containing a {configuration_file} file"
              )
  
      try:
          # Load config dict
          config_dict = cls._dict_from_json_file(resolved_config_file)
          # TODO: remove once transformers release version is way above 4.22.
          if _transformers_version_is_below_threshold:
              config_dict["_commit_hash"] = commit_hash
      except (json.JSONDecodeError, UnicodeDecodeError):
          raise EnvironmentError(
              f"It looks like the config file at '{resolved_config_file}' is not a valid JSON file."
          )
  
      if is_local:
          logger.info(
              f"loading configuration file {resolved_config_file}"
          )
      else:
          logger.info(
              f"loading configuration file {configuration_file} from cache at {resolved_config_file}"
          )
  
      return config_dict, kwargs
  
file_path: optimum/optimum/configuration_utils.py
imports: import copy
  import json
  import os
  import re
  from typing import Any, Dict, List, Tuple, Union
  from huggingface_hub import HfFolder
  from packaging import version
  from transformers import PretrainedConfig
  from transformers import __version__
  from .utils import logging
  from .version import __version__
label_desc: Use image node_id 5 for calling the BaseConfig obj's underlying member method code with example usage: obj._get_config_dict(cls, pretrained_model_name_or_path) and returns: config_dict,  kwargs