Error DeepSpeech Python API with Docker

Hi everyone,

I am currently working on a personal project involving STT and I found that DeepSpeech could help me a lot. All I want to do is inference, so I set up a simple python script to import a model and a scorer:

import deepspeech as ds

def test(model_path, scorer_path):
    model = ds.Model(model_path)
    return model

if __name__ == "__main__":
    mymodel = test('./models/deepspeech-0.9.3-models.tflite', "./models/deepspeech-0.9.3-models.scorer")

I ran it on my personal computer (MBP with intel processor), and it worked! Then I wanted to dockerize it to use my project on many platforms, so here is my Dockerfile:

FROM python:3.9

RUN apt update && \

apt install ffmpeg build-essential -y

RUN pip3 install deepspeech==0.9.3 deepspeech-tflite==0.9.3

WORKDIR /usr/app/src

COPY . .

ENTRYPOINT ["python3", ""]

But when I built my image and ran my container, I had the following error:

TensorFlow: v2.3.0-6-g23ad988
DeepSpeech: v0.9.3-0-gf2e9c85
Warning: reading entire model file into memory. Transform model file into an mmapped graph to reduce heap usage.
2022-10-15 14:56:05.219083: I tensorflow/core/platform/] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Data loss: Can't parse ./models/deepspeech-0.9.3-models.tflite as binary proto
Traceback (most recent call last):
  File "/usr/app/src/", line 9, in <module>
    mymodel = test('./models/deepspeech-0.9.3-models.tflite', "./models/deepspeech-0.9.3-models.scorer")
  File "/usr/app/src/", line 4, in test
    model = ds.Model(model_path)
  File "/usr/local/lib/python3.9/site-packages/deepspeech/", line 38, in __init__
    raise RuntimeError("CreateModel failed with '{}' (0x{:X})".format(deepspeech.impl.ErrorCodeToErrorMessage(status),status))
RuntimeError: CreateModel failed with 'Error reading the proto buffer model file.' (0x3005)

I can’t find a solution to this problem. Do you have any idea on this issue?

You should move to Coqui.