コード例 #1
0
def main(*args, **kwargs):
    FLAGS(sys.argv, known_only=True)
    if FLAGS.enable_eager_execution:
        tf.enable_eager_execution()
    else:
        tf.disable_eager_execution()
    FLAGS.unparse_flags()
    tf.test.main(*args, **kwargs)
コード例 #2
0
            f = tar.extractfile(tarinfo)
            wav_bytes = audio_lib.DecodeFlacToWav(f.read())
            f.close()
            frames = sess.run(log_mel, feed_dict={tf_bytes: wav_bytes})
            assert uttid in trans, uttid
            num_words = len(trans[uttid])
            tf.logging.info('utt[%d]: %s [%d frames, %d words]', n, uttid,
                            frames.shape[1], num_words)
            ex = _MakeTfExample(uttid, frames, trans[uttid])
            outf = _SelectRandomShard(recordio_writers)
            outf.write(ex.SerializeToString())
        tar.close()
    file_obj.close()
    _CloseSubShards(recordio_writers)


def main(_):
    tf.logging.set_verbosity(tf.logging.INFO)
    if FLAGS.dump_transcripts:
        _DumpTranscripts()
    elif FLAGS.generate_tfrecords:
        _CreateAsrFeatures()
    else:
        tf.logging.error(
            'Nothing to do! Use --dump_transcripts or --generate_tfrecords')


if __name__ == '__main__':
    tf.disable_eager_execution()
    tf.app.run(main)