code: def get_embeddings(
      speaker_model,
      manifest_file,
      batch_size=1,
      embedding_dir="./",
      device="cuda",
  ):
      """
      save embeddings to pickle file
      Args:
          speaker_model: NeMo <EncDecSpeakerLabel> model
          manifest_file: path to the manifest file containing the audio file path from which the
                         embeddings should be extracted
          batch_size: batch_size for inference
          embedding_dir: path to directory to store embeddings file
          device: compute device to perform operations
      """
  
      all_embs, _, _, _ = speaker_model.batch_inference(
          manifest_file, batch_size=batch_size, device=device
      )
      all_embs = np.asarray(all_embs)
      all_embs = embedding_normalize(all_embs)
      out_embeddings = {}
  
      with open(manifest_file, "r", encoding="utf-8") as manifest:
          for i, line in enumerate(manifest.readlines()):
              line = line.strip()
              dic = json.loads(line)
              uniq_name = "@".join(
                  dic["audio_filepath"].split("/")[-3:]
              )
              out_embeddings[uniq_name] = all_embs[i]
  
      embedding_dir = os.path.join(embedding_dir, "embeddings")
      if not os.path.exists(embedding_dir):
          os.makedirs(embedding_dir, exist_ok=True)
  
      prefix = manifest_file.split("/")[-1].rsplit(".", 1)[-2]
  
      name = os.path.join(embedding_dir, prefix)
      embeddings_file = name + "_embeddings.pkl"
      pkl.dump(out_embeddings, open(embeddings_file, "wb"))
      logging.info("Saved embedding files to {}".format(embedding_dir))
  
file_path: NeMo/examples/speaker_tasks/recognition/extract_speaker_embeddings.py
imports: import json
  import os
  import pickle
  from argparse import ArgumentParser
  import numpy
  import torch
  from nemo.collections.asr.models.label_models import EncDecSpeakerLabelModel
  from nemo.collections.asr.parts.utils.speaker_utils import embedding_normalize
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: get_embeddings(speaker_model, manifest_file, batch_size, embedding_dir, device) without return types