code: def process(args):
      root = Path(args.data_root).absolute()
      for lang in mTEDx.LANGPAIRS:
          cur_root = root / f"{lang}"
          if not cur_root.is_dir():
              print(f"{cur_root.as_posix()} does not exist. Skipped.")
              continue
          # Extract features
          audio_root = cur_root / (
              "flac" if args.use_audio_input else "fbank80"
          )
          audio_root.mkdir(exist_ok=True)
          for split in mTEDx.SPLITS:
              print(f"Fetching split {split}...")
              dataset = mTEDx(root.as_posix(), lang, split)
              if args.use_audio_input:
                  print("Converting audios...")
                  for waveform, sample_rate, _, _, _, utt_id in tqdm(
                      dataset
                  ):
                      tgt_sample_rate = 16_000
                      _wavform, _ = convert_waveform(
                          waveform,
                          sample_rate,
                          to_mono=True,
                          to_sample_rate=tgt_sample_rate,
                      )
                      sf.write(
                          (audio_root / f"{utt_id}.flac").as_posix(),
                          _wavform.numpy(),
                          tgt_sample_rate,
                      )
              else:
                  print("Extracting log mel filter bank features...")
                  for waveform, sample_rate, _, _, _, _, utt_id in tqdm(
                      dataset
                  ):
                      extract_fbank_features(
                          waveform,
                          sample_rate,
                          audio_root / f"{utt_id}.npy",
                      )
          # Pack features into ZIP
          zip_path = cur_root / f"{audio_root.name}.zip"
          print("ZIPing audios/features...")
          create_zip(audio_root, zip_path)
          print("Fetching ZIP manifest...")
          audio_paths, audio_lengths = get_zip_manifest(zip_path)
          # Generate TSV manifest
          print("Generating manifest...")
          train_text = []
          for split in mTEDx.SPLITS:
              is_train_split = split.startswith("train")
              manifest = {c: [] for c in MANIFEST_COLUMNS}
              ds = mTEDx(args.data_root, lang, split)
              for (
                  _,
                  _,
                  src_utt,
                  tgt_utt,
                  spk_id,
                  tgt_lang,
                  utt_id,
              ) in tqdm(ds):
                  manifest["id"].append(utt_id)
                  manifest["audio"].append(audio_paths[utt_id])
                  manifest["n_frames"].append(audio_lengths[utt_id])
                  manifest["tgt_text"].append(
                      src_utt if args.task == "asr" else tgt_utt
                  )
                  manifest["speaker"].append(spk_id)
                  manifest["tgt_lang"].append(tgt_lang)
              if is_train_split:
                  train_text.extend(manifest["tgt_text"])
              df = pd.DataFrame.from_dict(manifest)
              df = filter_manifest_df(df, is_train_split=is_train_split)
              save_df_to_tsv(df, cur_root / f"{split}_{args.task}.tsv")
          # Generate vocab
          v_size_str = (
              "" if args.vocab_type == "char" else str(args.vocab_size)
          )
          spm_filename_prefix = (
              f"spm_{args.vocab_type}{v_size_str}_{args.task}"
          )
          with NamedTemporaryFile(mode="w") as f:
              for t in train_text:
                  f.write(t + "\n")
              gen_vocab(
                  Path(f.name),
                  cur_root / spm_filename_prefix,
                  args.vocab_type,
                  args.vocab_size,
              )
          # Generate config YAML
          if args.use_audio_input:
              gen_config_yaml(
                  cur_root,
                  spm_filename=spm_filename_prefix + ".model",
                  yaml_filename=f"config_{args.task}.yaml",
                  specaugment_policy=None,
                  extra={"use_audio_input": True},
              )
          else:
              gen_config_yaml(
                  cur_root,
                  spm_filename=spm_filename_prefix + ".model",
                  yaml_filename=f"config_{args.task}.yaml",
                  specaugment_policy="lb",
              )
          # Clean up
          shutil.rmtree(audio_root)
  
imports: import argparse
  import logging
  import os
  from pathlib import Path
  import shutil
  from itertools import groupby
  from tempfile import NamedTemporaryFile
  from typing import Tuple
  import pandas
  import soundfile
  from examples.speech_to_text.data_utils import create_zip, extract_fbank_features, filter_manifest_df, gen_config_yaml, gen_vocab, get_zip_manifest, load_df_from_tsv, save_df_to_tsv
  import torch
  from torch.utils.data import Dataset
  from tqdm import tqdm
  from fairseq.data.audio.audio_utils import get_waveform, convert_waveform
label_desc: Use image node_id 1 for calling a global function with example usage: process(args) without return types