code: def get_transformer_embeddings(
      model: Model,
  ) -> List[TransformerEmbeddings]:
      embeddings = (
          model.tars_embeddings
          if isinstance(model, FewshotClassifier)
          else getattr(model, "embeddings", None)
      )
  
      if embeddings is None:
          log.warning(
              f"Could not extract embeddings of Model of type {type(model)}"
          )
          return []
  
      transformer_embeddings = set()
  
      def scan_embeddings(emb: Embeddings):
          if isinstance(emb, StackedEmbeddings):
              for sub_emb in emb.embeddings:
                  scan_embeddings(sub_emb)
          if isinstance(emb, TransformerEmbeddings):
              transformer_embeddings.add(emb)
  
      scan_embeddings(embeddings)
  
      return list(transformer_embeddings)
  
file_path: flair/flair/trainers/plugins/functional/reduce_transformer_vocab.py
imports: import logging
  from pathlib import Path
  from typing import List
  from transformer_smaller_training_vocab import reduce_train_vocab
  from flair.embeddings import Embeddings, StackedEmbeddings, TransformerEmbeddings
  from flair.models import FewshotClassifier
  from flair.nn import Model
  from flair.nn.model import ReduceTransformerVocabMixin
  from flair.trainers.plugins import TrainerPlugin
label_desc: Use image node_id 1 for calling a global function with example usage: get_transformer_embeddings(model) and returns: list, list