code: def main():
      parser = ArgumentParser()
      parser.add_argument(
          "--manifest",
          type=str,
          required=True,
          help="Path to manifest file",
      )
      parser.add_argument(
          "--model_path",
          type=str,
          default="titanet_large",
          required=False,
          help="path to .nemo speaker verification model file to extract embeddings, if not passed SpeakerNet-M model would be downloaded from NGC and used to extract embeddings",
      )
      parser.add_argument(
          "--batch_size",
          type=int,
          default=1,
          required=False,
          help="batch size",
      )
      parser.add_argument(
          "--embedding_dir",
          type=str,
          default="./",
          required=False,
          help="path to directory where embeddings need to stored default:'./'",
      )
      args = parser.parse_args()
      torch.set_grad_enabled(False)
  
      if args.model_path.endswith(".nemo"):
          logging.info(
              f"Using local speaker model from {args.model_path}"
          )
          speaker_model = EncDecSpeakerLabelModel.restore_from(
              restore_path=args.model_path
          )
      elif args.model_path.endswith(".ckpt"):
          speaker_model = EncDecSpeakerLabelModel.load_from_checkpoint(
              checkpoint_path=args.model_path
          )
      else:
          speaker_model = EncDecSpeakerLabelModel.from_pretrained(
              model_name="titanet_large"
          )
          logging.info(
              f"using pretrained titanet_large speaker model from NGC"
          )
  
      device = "cuda"
      if not torch.cuda.is_available():
          device = "cpu"
          logging.warning(
              "Running model on CPU, for faster performance it is adviced to use atleast one NVIDIA GPUs"
          )
  
      get_embeddings(
          speaker_model,
          args.manifest,
          batch_size=args.batch_size,
          embedding_dir=args.embedding_dir,
          device=device,
      )
  
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 2 for calling a global function with example usage: main() without return types