class_docstr: Problem spec for Commonvoice using clean and noisy data.
class_docstr_tok: ["Problem","spec","for","Commonvoice","using","clean","and","noisy","data","."]
code: def generator(
      self,
      data_dir,
      tmp_dir,
      datasets,
      eos_list=None,
      start_from=0,
      how_many=0,
  ):
      del eos_list
      i = 0
  
      filename = os.path.basename(_COMMONVOICE_URL)
      compressed_file = generator_utils.maybe_download(
          tmp_dir, filename, _COMMONVOICE_URL
      )
  
      read_type = "r:gz" if filename.endswith(".tgz") else "r"
      with tarfile.open(compressed_file, read_type) as corpus_tar:
          # Create a subset of files that don't already exist.
          #   tarfile.extractall errors when encountering an existing file
          #   and tarfile.extract is extremely slow. For security, check that all
          #   paths are relative.
          members = [
              f
              for f in corpus_tar
              if _is_relative(tmp_dir, f.name)
              and not _file_exists(tmp_dir, f.name)
          ]
          corpus_tar.extractall(tmp_dir, members=members)
  
      raw_data_dir = os.path.join(tmp_dir, "cv_corpus_v1")
      data_tuples = _collect_data(raw_data_dir)
      encoders = self.feature_encoders(data_dir)
      audio_encoder = encoders["waveforms"]
      text_encoder = encoders["targets"]
      for dataset in datasets:
          data_tuples = (
              tup for tup in data_tuples if tup[0].startswith(dataset)
          )
          for utt_id, media_file, text_data in tqdm.tqdm(
              sorted(data_tuples)[start_from:]
          ):
              if how_many > 0 and i == how_many:
                  return
              i += 1
              wav_data = audio_encoder.encode(media_file)
              yield {
                  "waveforms": wav_data,
                  "waveform_lens": [len(wav_data)],
                  "targets": text_encoder.encode(text_data),
                  "raw_transcript": [text_data],
                  "utt_id": [utt_id],
                  "spk_id": ["unknown"],
              }
  
imports: import csv
  import os
  import tarfile
  from tensorflow.compat.v1 import estimator
  import tqdm
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import speech_recognition
  from tensor2tensor.utils import registry
label_desc: Use image node_id 6 for calling the CommonVoice obj's underlying member method code with example usage: obj.generator(data_dir, tmp_dir, datasets, eos_list, start_from, how_many) without return types