code: def main():
      args = get_args()
      ckpt_path = args.fastpitch_model_ckpt
      input_manifest_filepaths = args.input_json_manifests
      output_json_manifest_root = args.output_json_manifest_root
  
      mel_root = output_json_manifest_root / "mels"
      mel_root.mkdir(exist_ok=True, parents=True)
  
      # load pretrained FastPitch model checkpoint
      suffix = ckpt_path.suffix
      if suffix == ".nemo":
          spec_model = FastPitchModel.restore_from(ckpt_path).eval()
      elif suffix == ".ckpt":
          spec_model = FastPitchModel.load_from_checkpoint(
              ckpt_path
          ).eval()
      else:
          raise ValueError(f"Unsupported suffix: {suffix}")
      if not args.cpu:
          spec_model.cuda()
      device = spec_model.device
  
      use_beta_binomial_interpolator = (
          spec_model.cfg.train_ds.dataset.get(
              "use_beta_binomial_interpolator", False
          )
      )
  
      for manifest in input_manifest_filepaths:
          logging.info(f"Processing {manifest}.")
          entries = []
          with open(manifest, "r") as fjson:
              for line in fjson:
                  entries.append(json.loads(line.strip()))
  
          if device == "cpu":
              new_entries = Parallel(n_jobs=args.num_workers)(
                  delayed(__generate_mels)(
                      entry,
                      spec_model,
                      device,
                      use_beta_binomial_interpolator,
                      mel_root,
                  )
                  for entry in entries
              )
          else:
              new_entries = []
              for entry in tqdm(entries):
                  new_entry = __generate_mels(
                      entry,
                      spec_model,
                      device,
                      use_beta_binomial_interpolator,
                      mel_root,
                  )
                  new_entries.append(new_entry)
  
          mel_manifest_path = (
              output_json_manifest_root
              / f"{manifest.stem}_mel{manifest.suffix}"
          )
          with open(mel_manifest_path, "w") as fmel:
              for entry in new_entries:
                  fmel.write(json.dumps(entry) + "\n")
          logging.info(
              f"Processing {manifest} is complete --> {mel_manifest_path}"
          )
  
file_path: NeMo/scripts/dataset_processing/tts/generate_mels.py
imports: import argparse
  import json
  from pathlib import Path
  import numpy
  import soundfile
  import torch
  from joblib import Parallel, delayed
  from tqdm import tqdm
  from nemo.collections.tts.models import FastPitchModel
  from nemo.collections.tts.parts.utils.tts_dataset_utils import BetaBinomialInterpolator, beta_binomial_prior_distribution
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types