code: def convert_streaming_dataset_to_nemo(
      dataset: IterableDataset,
      cfg: HFDatasetConversionConfig,
      basedir: str,
      manifest_filepath: str,
  ):
      """
      Converts a HF dataset to a audio-preprocessed Nemo dataset in Streaming mode.
      Also writes out a nemo compatible manifest file.
  
      Args:
          dataset: Iterable HF Dataset.
          cfg: HFDatasetConvertionConfig.
          basedir: Base output directory.
          manifest_filepath: Filepath of manifest.
      """
      # Disable until fix https://github.com/huggingface/datasets/pull/3556 is merged
      # dataset = dataset.map(build_map_dataset_to_nemo_func(cfg, basedir))
  
      ds_iter = iter(dataset)
  
      with open(manifest_filepath, "w") as manifest_f:
          for idx, sample in enumerate(
              tqdm.tqdm(
                  ds_iter,
                  desc=f"Processing {cfg.path} (split: {cfg.split}):",
                  unit=" samples",
              )
          ):
              audio_filepath = (
                  sample["audio"]["path"]
                  .split("::")[0]
                  .replace("zip://", "")
              )
              audio_filepath = os.path.abspath(
                  os.path.join(basedir, audio_filepath)
              )
              audio_filepath = prepare_audio_filepath(audio_filepath)
  
              soundfile.write(
                  audio_filepath,
                  sample["audio"]["array"],
                  samplerate=cfg.sampling_rate,
                  format="wav",
              )
  
              manifest_line = {
                  "audio_filepath": audio_filepath,
                  "text": sample["text"],
                  "duration": librosa.get_duration(
                      sample["audio"]["array"], sr=cfg.sampling_rate
                  ),
              }
  
              # remove large components from sample
              del sample["audio"]
              del sample["text"]
              if "file" in sample:
                  del sample["file"]
  
              manifest_line.update(sample)
  
              manifest_f.write(
                  f"{json.dumps(sample, ensure_ascii=cfg.ensure_ascii)}\n"
              )
  
imports: import json
  import os
  import traceback
  from dataclasses import dataclass, is_dataclass
  from typing import Optional
  import hydra
  import librosa
  import soundfile
  import tqdm
  from datasets import Audio, Dataset, IterableDataset, load_dataset
  from hydra.conf import HydraConf, RunDir
  from hydra.core.config_store import ConfigStore
  from omegaconf import OmegaConf
label_desc: Use image node_id 6 for calling a global function with example usage: convert_streaming_dataset_to_nemo(dataset, cfg, basedir, manifest_filepath) without return types