def feature_encoders(self, _):
     return {
         "inputs": None,  # Put None to make sure that the logic in
         # decoding.py doesn't try to convert the floats
         # into text...
         "waveforms": audio_encoder.AudioEncoder(),
         "targets": ByteTextEncoderWithEos(),
     }
Exemple #2
0
 def feature_encoders(self, data_dir):
     if self.is_8k:
         sample_rate = 8000
     else:
         sample_rate = 16000
     encoders = {
         "inputs": None,
         "waveforms": audio_encoder.AudioEncoder(sample_rate=sample_rate)
     }
     vocab_file = os.path.join(data_dir, "vocab",
                               "bpe.%d.t2t" % self.approx_vocab_size)
     target_encoder = SubwordTextEncoderWithEos(filename=vocab_file)
     encoders["targets"] = target_encoder
     return encoders