code: def load_embedding(
      src: str, embedding_type, layers
  ) -> TransformerEmbedding:
      """
      Load a pre-trained PyTorch text embedding from a directory.
      See the `:py:class:~alibi_detect.models.pytorch.TransformerEmbedding` documentation for a
      full description of the `embedding_type` and `layers` kwargs.
  
      Parameters
      ----------
      src
          Name of or path to the model.
      embedding_type
         Type of embedding to extract. Needs to be one of pooler_output,
         last_hidden_state, hidden_state or hidden_state_cls.
      layers
          A list with int's referring to the hidden layers used to extract the embedding.
  
      Returns
      -------
      The loaded embedding.
      """
      emb = TransformerEmbedding(
          src, embedding_type=embedding_type, layers=layers
      )
      return emb
  
file_path: alibi-detect/alibi_detect/saving/_pytorch/loading.py
imports: import logging
  import os
  from importlib import import_module
  from pathlib import Path
  from typing import Callable, Optional, Union, Type
  import dill
  import torch
  import torch.nn
  from alibi_detect.cd.pytorch import UAE, HiddenOutput
  from alibi_detect.cd.pytorch.preprocess import _Encoder
  from alibi_detect.models.pytorch import TransformerEmbedding
  from alibi_detect.utils.pytorch.kernels import DeepKernel
label_desc: Use image node_id 5 for calling a global function with example usage: load_embedding(src, embedding_type, layers) and returns: emb