diff --git a/README.md b/README.md index 64e0c72..7c9e728 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,38 @@ # Docker DeepSpeech Server - This is a dockerfile to serve a [deepspeech server](https://github.com/MainRo/deepspeech-server). # How to use this image +Create a deepspeech server configuration file as specified in config.example.yaml. Download and copy +a model tflite and a scorer file and run the following command: - docker run -dt --name deepspeech -p 0.0.0.0:8080:8080 -v [host-model-path]:/opt/deepspeech romainsah/deepspeech-server:latest + docker run -dt --name deepspeech \ + -p 0.0.0.0:8080:8080 \ + -v [host-model-path]:/opt/deepspeech \ + romainsah/deepspeech-server:latest where [host-model-path] is a host directory that contains the deepspeech server -configuration file, the model file, and the scorer file. +configuration file (e.g. config.yaml), the model file (e.g. model.tflite), and the scorer file (e.g. huge-vocabulary.scorer). ## Running on GPU +Change the tag of the docker image in above command to latest-gpu, like this: + + docker run -dt --name deepspeech \ + -p 0.0.0.0:8080:8080 \ + -v [host-model-path]:/opt/deepspeech \ + romainsah/deepspeech-server:latest-gpu + +## How to get the models + +The latest docker image was tested with the following model and scorer files: + +https://github.com/coqui-ai/STT-models/releases/download/english/coqui/v1.0.0-huge-vocab/model.tflite + +https://github.com/coqui-ai/STT-models/releases/download/english/coqui/v1.0.0-huge-vocab/huge-vocabulary.scorer + +## How to build this image - docker run -dt --gpus all --name deepspeech -p 0.0.0.0:8080:8080 -v [host-model-path]:/opt/deepspeech romainsah/deepspeech-server:latest-gpu + cd cpu && \ + docker build -t deepspeech-server:latest . + cd gpu && \ + docker build -t deepspeech-server:latest-gpu . \ No newline at end of file diff --git a/config.example.yaml b/config.example.yaml new file mode 100644 index 0000000..b9a7d95 --- /dev/null +++ b/config.example.yaml @@ -0,0 +1,15 @@ +coqui: + model: model.tflite + scorer: huge-vocabulary.scorer + beam_width: 500 + lm_alpha: 0.931289039105002 + lm_beta: 1.1834137581510284 +server: + http: + host: "0.0.0.0" + port: 8080 + request_max_size: 1048576 +log: + level: + - logger: deepspeech_server + level: DEBUG diff --git a/cpu/Dockerfile b/cpu/Dockerfile index 048c741..faa8eed 100644 --- a/cpu/Dockerfile +++ b/cpu/Dockerfile @@ -1,8 +1,11 @@ -FROM tensorflow/tensorflow:1.15.2-py3 +FROM tensorflow/tensorflow:2.17.0 -RUN pip3 install --upgrade pip +COPY requirements.txt /tmp -COPY cpu/requirements.txt /tmp -RUN pip3 install --no-cache-dir -r /tmp/requirements.txt +RUN apt update && apt install python3-pip -y -ENTRYPOINT deepspeech-server --config /opt/deepspeech/config.json +RUN python3 -m pip install --upgrade pip + +RUN python3 -m pip install --no-cache-dir -r /tmp/requirements.txt + +ENTRYPOINT ["deepspeech-server", "--config", "/opt/deepspeech/config.yaml"] \ No newline at end of file diff --git a/cpu/requirements.txt b/cpu/requirements.txt index 76bc8cb..10a014e 100644 --- a/cpu/requirements.txt +++ b/cpu/requirements.txt @@ -1,2 +1,5 @@ -deepspeech==0.8.2 -deepspeech-server==2.1.0 \ No newline at end of file +deepspeech-server>=3.0.1 +numpy<2 +cyclotron~=1.2 +cyclotron-aiohttp~=1.0 +cyclotron-std~=1.0 \ No newline at end of file diff --git a/gpu/Dockerfile b/gpu/Dockerfile index 5437a36..3d8681b 100644 --- a/gpu/Dockerfile +++ b/gpu/Dockerfile @@ -1,8 +1,11 @@ -FROM tensorflow/tensorflow:1.15.2-gpu-py3 +FROM tensorflow/tensorflow:2.17.0-gpu -RUN pip3 install --upgrade pip +COPY requirements.txt /tmp -COPY gpu/requirements.txt /tmp -RUN pip3 install --no-cache-dir -r /tmp/requirements.txt +RUN apt update && apt install python3-pip -y -ENTRYPOINT deepspeech-server --config /opt/deepspeech/config.json +RUN python3 -m pip install --upgrade pip + +RUN python3 -m pip install --no-cache-dir -r /tmp/requirements.txt + +ENTRYPOINT ["deepspeech-server", "--config", "/opt/deepspeech/config.yaml"] \ No newline at end of file diff --git a/gpu/requirements.txt b/gpu/requirements.txt index f261279..10a014e 100644 --- a/gpu/requirements.txt +++ b/gpu/requirements.txt @@ -1,2 +1,5 @@ -deepspeech-gpu==0.8.2 -deepspeech-server==2.1.0 \ No newline at end of file +deepspeech-server>=3.0.1 +numpy<2 +cyclotron~=1.2 +cyclotron-aiohttp~=1.0 +cyclotron-std~=1.0 \ No newline at end of file