code: def load_config(config_path: str) -> Coqpit:
      """Import `json` or `yaml` files as TTS configs. First, load the input file as a `dict` and check the model name
      to find the corresponding Config class. Then initialize the Config.
  
      Args:
          config_path (str): path to the config file.
  
      Raises:
          TypeError: given config file has an unknown type.
  
      Returns:
          Coqpit: TTS config object.
      """
      config_dict = {}
      ext = os.path.splitext(config_path)[1]
      if ext in (".yml", ".yaml"):
          with fsspec.open(config_path, "r", encoding="utf-8") as f:
              data = yaml.safe_load(f)
      elif ext == ".json":
          try:
              with fsspec.open(config_path, "r", encoding="utf-8") as f:
                  data = json.load(f)
          except json.decoder.JSONDecodeError:
              # backwards compat.
              data = read_json_with_comments(config_path)
      else:
          raise TypeError(f" [!] Unknown config file type {ext}")
      config_dict.update(data)
      model_name = _process_model_name(config_dict)
      config_class = register_config(model_name.lower())
      config = config_class()
      config.from_dict(config_dict)
      return config
  
file_path: TTS/TTS/config/__init__.py
imports: import json
  import os
  import re
  from typing import Dict
  import fsspec
  import yaml
  from coqpit import Coqpit
  from TTS.config.shared_configs import *
  from TTS.utils.generic_utils import find_module
label_desc: Use image node_id 4 for calling a global function with example usage: load_config(config_path) and returns: config