code: def slurp_inference(
      model,
      path2manifest: str,
      batch_size: int = 4,
      num_workers: int = 0,
  ) -> List[str]:
      if num_workers is None:
          num_workers = min(batch_size, os.cpu_count() - 1)
  
      # We will store transcriptions here
      hypotheses = []
      # Model's mode and device
      mode = model.training
      device = next(model.parameters()).device
      dither_value = model.preprocessor.featurizer.dither
      pad_to_value = model.preprocessor.featurizer.pad_to
  
      try:
          model.preprocessor.featurizer.dither = 0.0
          model.preprocessor.featurizer.pad_to = 0
          # Switch model to evaluation mode
          model.eval()
  
          logging_level = logging.get_verbosity()
          logging.set_verbosity(logging.WARNING)
  
          config = {
              "manifest_filepath": path2manifest,
              "batch_size": batch_size,
              "num_workers": num_workers,
          }
  
          temporary_datalayer = model._setup_transcribe_dataloader(
              config
          )
          for test_batch in tqdm(
              temporary_datalayer, desc="Transcribing", ncols=80
          ):
              predictions = model.predict(
                  input_signal=test_batch[0].to(device),
                  input_signal_length=test_batch[1].to(device),
              )
  
              hypotheses += predictions
  
              del predictions
              del test_batch
  
      finally:
          # set mode back to its original value
          model.train(mode=mode)
          model.preprocessor.featurizer.dither = dither_value
          model.preprocessor.featurizer.pad_to = pad_to_value
          logging.set_verbosity(logging_level)
      return hypotheses
  
file_path: NeMo/examples/slu/speech_intent_slot/eval_utils/inference.py
imports: import contextlib
  import glob
  import json
  import os
  from dataclasses import dataclass, is_dataclass
  from pathlib import Path
  from typing import List, Optional
  import pytorch_lightning
  import torch
  from omegaconf import OmegaConf
  from tqdm.auto import tqdm
  from nemo.collections.asr.models import SLUIntentSlotBPEModel
  from nemo.collections.asr.parts.utils.slu_utils import SequenceGeneratorConfig
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: slurp_inference(model, path2manifest, batch_size, num_workers) and returns: hypotheses