code: def test_dali_tarred_char_vs_ref_dataset(self, test_data_dir):
      manifest_path = os.path.abspath(
          os.path.join(
              test_data_dir, "asr/tarred_an4/tarred_audio_manifest.json"
          )
      )
      audio_tar_filepaths = [
          os.path.abspath(
              os.path.join(
                  test_data_dir, f"asr/tarred_an4/audio_{idx}.tar"
              )
          )
          for idx in range(2)
      ]
      audio_tar_index_filepaths = [
          os.path.abspath(
              os.path.join(
                  test_data_dir,
                  f"asr/tarred_an4/dali_index/audio_{idx}.index",
              )
          )
          for idx in range(2)
      ]
  
      batch_size = 8
      texts = []
  
      with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8") as f:
          num_samples = 0
          with open(manifest_path, "r") as m:
              for ix, line in enumerate(m):
                  data = json.loads(line)
                  texts.append(data["text"])
                  num_samples = ix
  
          preprocessor = {
              "_target_": "nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor",
              "dither": 0.0,
          }
          preprocessor_cfg = DictConfig(preprocessor)
  
          dataset_cfg = {
              "manifest_filepath": f.name,
              "tarred_audio_filepaths": audio_tar_filepaths,
              "tarred_audio_index_filepaths": audio_tar_index_filepaths,
              "sample_rate": 16000,
              "labels": self.labels,
              "batch_size": batch_size,
              "trim_silence": False,
              "max_duration": 16.7,
              "shuffle": False,
              "is_tarred": False,
          }
          dali_dataset = audio_to_text_dataset.get_dali_char_dataset(
              config=dataset_cfg,
              shuffle=False,
              device_id=0,
              global_rank=0,
              world_size=1,
              preprocessor_cfg=preprocessor_cfg,
          )
          ref_dataset = audio_to_text_dataset.get_tarred_dataset(
              config=dataset_cfg,
              shuffle_n=0,
              global_rank=0,
              world_size=1,
          )
          ref_dataloader = DataLoader(
              dataset=ref_dataset,
              batch_size=batch_size,
              collate_fn=ref_dataset.collate_fn,
              drop_last=False,
              shuffle=False,
              num_workers=0,
              pin_memory=False,
          )
          ref_preprocessor = EncDecCTCModel.from_config_dict(
              preprocessor_cfg
          )
  
          for ref_data, dali_data in zip(ref_dataloader, dali_dataset):
              ref_audio, ref_audio_len, _, _ = ref_data
              ref_features, ref_features_len = ref_preprocessor(
                  input_signal=ref_audio, length=ref_audio_len
              )
  
              dali_features, dali_features_len, _, _ = dali_data
  
              a = ref_features.cpu().numpy()[:, :, :ref_features_len]
              b = dali_features.cpu().numpy()[:, :, :dali_features_len]
  
              err = np.abs(a - b)
              assert np.mean(err) < 0.0001
              assert np.max(err) < 0.01
  
imports: import copy
  import filecmp
  import json
  import os
  import shutil
  import tempfile
  from unittest import mock
  import numpy
  import pytest
  import soundfile
  import torch.cuda
  from omegaconf import DictConfig, OmegaConf
  from torch.utils.data import DataLoader
  from nemo.collections.asr.data import audio_to_audio_dataset, audio_to_text_dataset
  from nemo.collections.asr.data.audio_to_audio import ASRAudioProcessor, AudioToTargetDataset, AudioToTargetWithEmbeddingDataset, AudioToTargetWithReferenceDataset, _audio_collate_fn
  from nemo.collections.asr.data.audio_to_text import DataStoreObject, TarredAudioToBPEDataset, TarredAudioToCharDataset, cache_datastore_manifests
  from nemo.collections.asr.data.audio_to_text_dali import __DALI_MINIMUM_VERSION__, AudioToBPEDALIDataset, AudioToCharDALIDataset, is_dali_supported
  from nemo.collections.asr.data.audio_to_text_dataset import inject_dataloader_value_from_model_config
  from nemo.collections.asr.data.feature_to_text import FeatureToBPEDataset, FeatureToCharDataset
  from nemo.collections.asr.models.ctc_models import EncDecCTCModel
  from nemo.collections.asr.parts.utils.audio_utils import get_segment_start
  from nemo.collections.asr.parts.utils.manifest_utils import write_manifest
  from nemo.collections.common import tokenizers
  from nemo.utils import logging
label_desc: Use image node_id 8 for calling the TestASRDatasets obj's underlying member method code with example usage: obj.test_dali_tarred_char_vs_ref_dataset(test_data_dir) without return types