【问题标题】:How do I convert a Coqui Tensorflow model to .tflite?如何将 Coqui Tensorflow 模型转换为 .tflite?
【发布时间】:2021-08-02 06:53:58
【问题描述】:

我有来自 GitHub 的 Coqui STT yesno model,这是一个超紧凑的语音识别模型,只能识别两个词:yes 和 no。

我有 yesno.pbmmyesno.scorer 文件。

我还有一个压缩包coqui-yesno-checkpoints.tar.gz,其中包含以下文件:

ls -l coqui-yesno-checkpoints/
total 7356
-rw-r--r-- 1 jeremiah jeremiah      12 Jul 27 00:00 alphabet.txt
-rw-r--r-- 1 jeremiah jeremiah 1066076 Jul 26 23:59 best_dev-1909.data-00000-of-00001
-rw-r--r-- 1 jeremiah jeremiah    1377 Jul 26 23:59 best_dev-1909.index
-rw-r--r-- 1 jeremiah jeremiah 4476795 Jul 26 23:59 best_dev-1909.meta
-rw-r--r-- 1 jeremiah jeremiah      83 Jul 27 00:00 best_dev_checkpoint
-rw-r--r-- 1 jeremiah jeremiah    3861 Jul 27 00:02 flags.txt
-rw-r--r-- 1 jeremiah jeremiah 1368905 Jul 27 00:05 yesno-64dims.logs
-rw-r--r-- 1 jeremiah jeremiah  594622 Jul 27 00:05 yesno-64dims.logs.lm-optimizer

如何将此模型转换为 .tflite 文件,以便在嵌入式设备上与 Coqui 一起使用?

寻找可以轻松编写脚本的命令行解决方案。

【问题讨论】:

标签: tensorflow speech-to-text tensorflow-lite coqui


【解决方案1】:

Coqui STT 源自 Mozilla 的 DeepSpeech。我和 Coqui 的创始人之一 Josh Meyer 一起为 DeepSpeech 写了PlayBookCoqui STT training documentation 不包括将模型导出tflite,因此我建议从 DeepSpeech 文档开始 - 因为语法通常可以互换。

也就是说,您需要从 Coqui 运行 train.py,指定您拥有的检查点,并传递 --export_tflite 标志。这应该从检查点创建一个tflite 模型。默认情况下,DeepSpeech 会导出一个protobuf (.pb) 文件,但我不知道 Coqui 的默认导出格式是什么。

猜测,这看起来像:

python3 train.py \
  --train_files [location of your train csv] \
  --dev_files [location of your dev csv] \
  --test_files [location of your test csv] \
  --checkpoint_dir [location of your checkpoints] \
  --export_dir [where you want your model exported to] \
  --export_tflite

希望这会有所帮助 - 有兴趣了解您的进展情况。

【讨论】:

    猜你喜欢
    • 2019-05-06
    • 1970-01-01
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 2020-09-10
    • 2018-08-17
    • 1970-01-01
    • 2021-01-15
    相关资源
    最近更新 更多