code: def extract_audio_features(
      manifest_filepath: str, cfg: DictConfig, record_fn: Callable
  ) -> str:
      file_list = []
      manifest_data = []
      out_dir = Path(cfg.output_dir) / Path("features")
      new_manifest_filepath = str(
          Path(cfg.output_dir)
          / Path("temp_manifest_input_feature.json")
      )
  
      if Path(new_manifest_filepath).is_file():
          logging.info(
              "Features already exist in output_dir, skipping feature extraction."
          )
          return new_manifest_filepath
  
      has_feat = False
      with open(manifest_filepath, "r", encoding="utf-8") as fin:
          for line in fin.readlines():
              item = json.loads(line.strip())
              manifest_data.append(item)
              file_list.append(Path(item["audio_filepath"]).stem)
              if "feature_file" in item:
                  has_feat = True
      if has_feat:
          logging.info(
              "Features already exist in manifest, skipping feature extraction."
          )
          return manifest_filepath
  
      out_dir.mkdir(parents=True, exist_ok=True)
      torch.set_grad_enabled(False)
      if cfg.vad_model:
          vad_model = init_frame_vad_model(cfg.vad_model)
      else:
          vad_model = EncDecClassificationModel.from_pretrained(
              "vad_multilingual_marblenet"
          )
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      vad_model = vad_model.to(device)
      vad_model.eval()
      vad_model.setup_test_data(
          test_data_config={
              "batch_size": 1,
              "vad_stream": False,
              "sample_rate": cfg.sample_rate,
              "manifest_filepath": manifest_filepath,
              "labels": [
                  "infer",
              ],
              "num_workers": cfg.num_workers,
              "shuffle": False,
              "normalize_audio_db": cfg.normalize_audio_db,
          }
      )
  
      logging.info(
          f"Extracting features on {len(file_list)} audio files..."
      )
      with record_fn("feat_extract_loop"):
          for i, test_batch in enumerate(
              tqdm(
                  vad_model.test_dataloader(),
                  total=len(vad_model.test_dataloader()),
              )
          ):
              test_batch = [x.to(vad_model.device) for x in test_batch]
              with autocast():
                  with record_fn("feat_extract_infer"):
                      (
                          processed_signal,
                          processed_signal_length,
                      ) = vad_model.preprocessor(
                          input_signal=test_batch[0],
                          length=test_batch[1],
                      )
                  with record_fn("feat_extract_other"):
                      processed_signal = processed_signal.squeeze(0)[
                          :, :processed_signal_length
                      ]
                      processed_signal = processed_signal.cpu()
                      outpath = os.path.join(
                          out_dir, file_list[i] + ".pt"
                      )
                      outpath = str(Path(outpath).absolute())
                      torch.save(processed_signal, outpath)
                      manifest_data[i]["feature_file"] = outpath
                      del test_batch
  
      logging.info(f"Features saved at: {out_dir}")
      write_manifest(new_manifest_filepath, manifest_data)
      return new_manifest_filepath
  
imports: import contextlib
  import json
  import os
  import time
  from dataclasses import dataclass, is_dataclass
  from pathlib import Path
  from typing import Callable, Optional
  import torch
  import yaml
  from omegaconf import DictConfig, OmegaConf
  from torch.profiler import ProfilerActivity, profile, record_function
  from tqdm import tqdm
  from nemo.collections.asr.data import feature_to_text_dataset
  from nemo.collections.asr.metrics.wer import word_error_rate
  from nemo.collections.asr.models import ASRModel, EncDecClassificationModel
  from nemo.collections.asr.parts.submodules import CTCDecodingConfig
  from nemo.collections.asr.parts.submodules.rnnt_decoding import RNNTDecodingConfig
  from nemo.collections.asr.parts.utils.manifest_utils import read_manifest, write_manifest
  from nemo.collections.asr.parts.utils.vad_utils import generate_overlap_vad_seq, generate_vad_segment_table, get_vad_stream_status, init_frame_vad_model, init_vad_model
  from nemo.core.config import hydra_runner
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: extract_audio_features(manifest_filepath, cfg, record_fn) and returns: new_manifest_filepath, new_manifest_filepath, manifest_filepath