Creating tflite file for Android

How do you convert custom trained .pb file to .tflite file?

Above python converter produces following error: Converting unsupported operation: BlockLSTM

If deepspeech uses LSTM and you are not able to convert .pb files with LSTM to .tflite, can you deploy custom model on Android at all?

Pretrained model with android_mic_streaming is working fine, but unable to convert my own model.

Okey. I used --export_tflite flag in training to get the tflite file but following error occurs after training and model is not created:

tensorflow.lite.python.convert.ConverterError: See console for info.
/bin/sh: 1: toco_from_protos: not found

Did you follow the steps provided in the docs? Where exactly does it happen?

Yep, when doing the training it says:

When trying to convert using checkpoints:

Added following exports to .bashrc:

export PATH="/home/tuomas/.local/bin/toco_from_protos:$PATH"

export PATH="/home/tuomas/.local/lib/python3.6/site-packages/tensorflow_core/lite/toco/python/:$PATH"

export PATH="/home/tuomas/.local/lib/python3.6/site-packages/tensorflow_core/lite/toco/python/pycache/:$PATH"

but no luck.

Use venv and give full commands:

This is a problem with your TensorFlow install, sorry.

From your stack, it looks like you have not followed the documentation and setup a virtualenv.

Please ensure you follow the docs.

Now I did folow docs step by step and same error occurs.


I installed tensorflow 1.15.4 normally and is at that ("…/toco/python/toco_from_protos") destination. What am I missing?

Why is it still using “/home/tuomas/.local/lib/python3.6/site-packages/tensorflow_core/lite/python/” when I am using virtual env?

Hard to tell whether you use it or not without the command line … read about virtual environments first.