code: def save_embedding_config(
      embed: TransformerEmbedding,
      base_path: Path,
      local_path: Path = Path("."),
  ) -> dict:
      """
      Save embeddings for text drift models.
  
      Parameters
      ----------
      embed
          Embedding model.
      base_path
          Base filepath to save to (the location of the `config.toml` file).
      local_path
          A local (relative) filepath to append to base_path.
      """
      # create folder to save model in
      filepath = base_path.joinpath(local_path)
      if not filepath.is_dir():
          logger.warning(
              "Directory {} does not exist and is now created.".format(
                  filepath
              )
          )
          filepath.mkdir(parents=True, exist_ok=True)
  
      # Populate config dict
      cfg_embed: Dict[str, Any] = {}
      cfg_embed.update({"type": embed.emb_type})
      cfg_embed.update({"layers": embed.hs_emb.keywords["layers"]})
      cfg_embed.update({"src": local_path})
      cfg_embed.update({"flavour": Framework.PYTORCH.value})
  
      # Save embedding model
      logger.info("Saving embedding model to {}.".format(filepath))
      embed.model.save_pretrained(filepath)
  
      return cfg_embed
  
file_path: alibi-detect/alibi_detect/saving/_pytorch/saving.py
imports: import os
  import logging
  from pathlib import Path
  from typing import Any, Callable, Dict, Optional, Tuple, Union
  import dill
  import torch
  import torch.nn
  from alibi_detect.cd.pytorch import UAE, HiddenOutput
  from alibi_detect.models.pytorch import TransformerEmbedding
  from alibi_detect.utils.frameworks import Framework
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 3 for calling a global function with example usage: save_embedding_config(embed, base_path, local_path) and returns: cfg_embed