code: def _save_model_config(
      model: Any,
      base_path: Path,
      input_shape: Optional[tuple] = None,
      path: Path = Path("."),
  ) -> Tuple[dict, Optional[dict]]:
      """
      Save a model to a config dictionary. When a model has a text embedding model contained within it,
      this is extracted and saved separately.
  
      Parameters
      ----------
      model
          The model to save.
      base_path
          Base filepath to save to.
      input_shape
          The input dimensions of the model (after the optional embedding has been applied).
      path
          A local (relative) filepath to append to base_path.
  
      Returns
      -------
      A tuple containing the model and embedding config dicts.
      """
      if isinstance(model, supported_models_tf):
          return save_model_config_tf(
              model, base_path, input_shape, path
          )
      elif isinstance(model, supported_models_torch):
          return save_model_config_pt(model, base_path, path)
      elif isinstance(model, supported_models_sklearn):
          return save_model_config_sk(model, base_path, path), None
      else:
          raise NotImplementedError(
              "Support for saving the given model is not yet implemented"
          )
  
imports: import logging
  import os
  import shutil
  import warnings
  from functools import partial
  from pathlib import Path
  from typing import Callable, Optional, Tuple, Union, Any, Dict, TYPE_CHECKING
  import dill
  import numpy
  import toml
  from transformers import PreTrainedTokenizerBase
  from alibi_detect.saving._typing import VALID_DETECTORS
  from alibi_detect.saving.loading import _replace, validate_config, STATE_PATH
  from alibi_detect.saving.registry import registry
  from alibi_detect.utils._types import supported_models_all, supported_models_tf, supported_models_torch, supported_models_sklearn
  from alibi_detect.base import Detector, ConfigurableDetector, StatefulDetectorOnline
  from alibi_detect.saving._tensorflow import save_detector_legacy, save_model_config_tf, save_optimizer_config_tf
  from alibi_detect.saving._pytorch import save_model_config_pt, save_device_pt
  from alibi_detect.saving._sklearn import save_model_config_sk
label_desc: Use image node_id 9 for calling a global function with example usage: _save_model_config(model, base_path, input_shape, path) and returns: save_model_config_tf, save_model_config_pt, save_model_config_sk,  None