class_docstr: Base class for all configuration classes. Handles a few parameters common to all models' configurations as well as
  methods for loading/downloading/saving configurations.
class_docstr_tok: ["Base","class","for","all","configuration","classes",".","Handles","a","few","parameters","common","to","all","models","'","configurations","as","well","as","methods","for","loading\/downloading\/saving","configurations","."]
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", DIFFUSERS_CACHE)
      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)
      subfolder = kwargs.pop("subfolder", None)
  
      user_agent = {"file_type": "config"}
  
      pretrained_model_name_or_path = str(pretrained_model_name_or_path)
  
      if cls.config_name is None:
          raise ValueError(
              "`self.config_name` is not defined. Note that one should not load a config from "
              "`ConfigMixin`. Please make sure to define `config_name` in a class inheriting from `ConfigMixin`"
          )
  
      if os.path.isfile(pretrained_model_name_or_path):
          config_file = pretrained_model_name_or_path
      elif os.path.isdir(pretrained_model_name_or_path):
          if os.path.isfile(
              os.path.join(
                  pretrained_model_name_or_path, cls.config_name
              )
          ):
              # Load from a PyTorch checkpoint
              config_file = os.path.join(
                  pretrained_model_name_or_path, cls.config_name
              )
          elif subfolder is not None and os.path.isfile(
              os.path.join(
                  pretrained_model_name_or_path,
                  subfolder,
                  cls.config_name,
              )
          ):
              config_file = os.path.join(
                  pretrained_model_name_or_path,
                  subfolder,
                  cls.config_name,
              )
          else:
              raise EnvironmentError(
                  f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."
              )
      else:
          try:
              # Load from URL or cache if already cached
              from huggingface_hub import hf_hub_download
  
              config_file = hf_hub_download(
                  pretrained_model_name_or_path,
                  filename=cls.config_name,
                  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,
                  subfolder=subfolder,
              )
  
          except HTTPError as err:
              raise EnvironmentError(
                  "There was a specific connection error when trying to load"
                  f" {pretrained_model_name_or_path}:\n{err}"
              )
          except ValueError:
              raise EnvironmentError(
                  f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load this model, couldn't find it"
                  f" in the cached files and it looks like {pretrained_model_name_or_path} is not the path to a"
                  f" directory containing a {cls.config_name} file.\nCheckout your internet connection or see how to"
                  " run the library in offline mode at"
                  " 'https://huggingface.co/docs/diffusers/installation#offline-mode'."
              )
          except EnvironmentError:
              raise EnvironmentError(
                  f"Can't load config for '{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 name. "
                  f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory "
                  f"containing a {cls.config_name} file"
              )
  
      try:
          # Load config dict
          config_dict = cls._dict_from_json_file(config_file)
      except (json.JSONDecodeError, UnicodeDecodeError):
          raise EnvironmentError(
              f"It looks like the config file at '{config_file}' is not a valid JSON file."
          )
  
      return config_dict
  
imports: import functools
  import inspect
  import json
  import os
  import re
  from collections import OrderedDict
  from typing import Any
  from typing import Dict
  from typing import Tuple
  from typing import Union
  from requests import HTTPError
  from paddlehub.common.logger import logger
label_desc: Use image node_id 4 for calling the ConfigMixin obj's underlying member method code with example usage: obj.get_config_dict(cls, pretrained_model_name_or_path) and returns: config_dict