GithubHelp home page GithubHelp logo

jcsilva / docker-kaldi-gstreamer-server Goto Github PK

View Code? Open in Web Editor NEW
287.0 22.0 140.0 497 KB

Dockerfile for kaldi-gstreamer-server.

License: BSD 2-Clause "Simplified" License

Shell 30.43% Dockerfile 69.57%
kaldi kaldi-gstreamer-server asr docker worker-server

docker-kaldi-gstreamer-server's Introduction

docker-kaldi-gstreamer-server

Dockerfile for kaldi-gstreamer-server.

Synopsis

This dockerfile automatically builds master and worker servers that are explained at Full-duplex Speech-to-text System for Estonian from Tanel Alumäe and implemented by himself at https://github.com/alumae/kaldi-gstreamer-server.

Using this project you will be able to run an automatic speech recognition (ASR) server in a few minutes.

Attention

The ASR server that will be set up here requires some kaldi models. In the docker image I will detail below, there are no kaldi models included.

You must have these models on your machine. You must also have an yaml file describing these models. Please, check some examples here, here and here to find out how to write your own yaml files.

There are some kaldi models available for download. I have tested my setup with this one, which is for English. I'm trying to build a model for Brazilian Portuguese, but until now I didn't find enough free/open resources.

Install docker

Please, refer to https://docs.docker.com/engine/installation/.

Get the image

  • Pull the image from Docker Hub (~ 900MB):

docker pull jcsilva/docker-kaldi-gstreamer-server

  • Or you may build your own image (requires git):

docker build -t kaldi-gstreamer-server:1.0 https://github.com/jcsilva/docker-kaldi-gstreamer-server.git

In the next sections I'll assume you pulled the image from Docker Hub. If you have built your own image, simply change jcsilva/docker-kaldi-gstreamer-server:latest by your image name when appropriate.

How to use

It's possible to use the same docker in two scenarios. You may create the master and worker on the same host machine. Or you can create just a worker and connect it to an already existing master. These two situations are explained below.

  • Instantiate master server and worker server on the same machine:

Assuming that your kaldi models are located at /media/kaldi_models on your host machine, create a container:

docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash

And, inside the container, start the service:

 /opt/start.sh -y /opt/models/nnet2.yaml

You will see that 2 .log files (worker.log and master.log) will be created at /opt of your containter. If everything goes ok, you will see some lines indicating that there is a worker available. In this case, you can go back to your host machine (Ctrl+P and Ctrl+Q on the container). Your ASR service will be listening on port 8080.

For stopping the servers, you may execute the following command inside your container:

 /opt/stop.sh
  • Instantiate a worker server and connect it to a remote master:

Assuming that your kaldi models are located at /media/kaldi_models on your host machine, create a container:

docker run -it -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash

And, inside the container, start the service:

/opt/start.sh -y /opt/models/nnet2.yaml -m master-server.com -p 8888

It instantiates a worker on your local host and connects it to a master server located at master-server.com:8888.

You will see that a worker.log file will be created at /opt of your container. If everything goes ok, you will see some lines indicating that there is a worker available.

For stopping the worker server, you may execute the following command inside your container:

 /opt/stop.sh

Testing

First of all, please, check if your setup is ok. It can be done using your browser following these steps:

  1. Open a websocket client in your browser (e.g: Simple-WebSocket-Client or http://www.websocket.org/echo.html).

  2. Connect to your master server: ws://MASTER_SERVER/client/ws/status. If your master is on local host port 8080, you can try: ws://localhost:8080/client/ws/status.

  3. If your setup is ok, the answer is going to be something like: RESPONSE: {"num_workers_available": 1, "num_requests_processed": 0}.

After checking the setup, you should test your speech recognition service. For this, there are several options, and the following list gives some ideas:

  1. You can download this client for your host machine and execute it. When the master is on the local host, port 8080 and you have a wav file sampled at 16 kHz located at /home/localhost/audio/, you can type: python client.py -u ws://localhost:8080/client/ws/speech -r 32000 /home/localhost/audio/sample16k.wav

  2. You can use Kõnele for testing the service. It is an Android app that is freely available for downloading at Google Play. You must configure it to use your ASR service. Below you'll find some screenshots that may help you in this configuration. First, you should click on Kõnele (fast recognition). Then, change the WebSocket URL. In my case, I connected to a master server located at ws://192.168.1.10:8080/client/ws/speech. After that, open a notepad-like application and change your input method to Kõnele speech keyboard and you'll see a yellow button instead of your traditional keyboard. Press this button and enjoy!

Kõnele configuration

 

Kõnele configuration

 

Kõnele configuration

 

Kõnele configuration

 

Kõnele configuration

 

Kõnele configuration

  1. A Javascript client is available at http://kaljurand.github.io/dictate.js/. You must configure it to use your ASR service.

Practical Example

This section describes a tested example. You may repeat all the steps and, in the end, you'll have an english ASR system working on your machine. For this example, I advise you to use a machine with at least 4GB RAM.

On the host machine, we are going to work on the directory /media/kaldi_models. I'll assume you have all permissions necessary to execute the following commands.

  1. Download a valid kaldi model:
cd /media/kaldi_models
wget https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz
tar -zxvf tedlium_nnet_ms_sp_online.tgz
  1. Copy an example yaml file to /media/kaldi_models:
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/sample_english_nnet2.yaml -P /media/kaldi_models
  1. Update file contents:
find /media/kaldi_models/ -type f | xargs sed -i 's:test:/opt:g'
sed -i 's:full-post-processor:#full-post-processor:g' /media/kaldi_models/sample_english_nnet2.yaml
  1. Instantiate master and worker on the same machine:
docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash
  1. Inside the docker container, start the service:
/opt/start.sh -y /opt/models/sample_english_nnet2.yaml
  1. On your host machine, download a client example and test your setup with a given audio:
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/kaldigstserver/client.py -P /tmp
wget https://raw.githubusercontent.com/jcsilva/docker-kaldi-gstreamer-server/master/audio/1272-128104-0000.wav -P /tmp
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/test/data/bill_gates-TED.mp3 -P /tmp
python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 32000 /tmp/1272-128104-0000.wav
python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 8192 /tmp/bill_gates-TED.mp3

OBS: For running the client example, you must install ws4py version 0.3.2. This can be installed using pip install --user ws4py==0.3.2. You may also need simplejson and pyaudio. They may also be installed using pip.

You should get these transcriptions:

  • Audio bill_gates-TED.mp3:

and i was a kid the disaster we worry about most was a nuclear war. that's why we had a barrel like this down our basement filled with cans of food and water. when the nuclear attack came we were supposed to go downstairs hunker down and eat out of that barrel. today the grea/opt risk of global catastrophe. doesn't look like this instead it looks like this. if anything kills over ten million people in the next few decades it's most likely to be a highly infectious virus rather than a war. not missiles that microbes now part of the reason for this is that we have invested a huge amount in nuclear deterrence we've actually invested very little in a system to stop an epidemic. we're not ready for the next epidemic.

  • Audio 1272-128104-0000.wav:

mr coulter is the apostle of the middle classes and we're glad to welcome his gospel.

Credits

docker-kaldi-gstreamer-server's People

Contributors

bk203 avatar gospodima avatar husseinfo avatar jcsilva avatar kaljurand avatar luozihyuan avatar mdoulaty avatar rdavidson avatar tomjorquera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-kaldi-gstreamer-server's Issues

Error while building my own image

Hello, I used docker build -t kaldi-gstreamer-server:1.0 https://github.com/jcsilva/docker-kaldi-gstreamer-server.git to build my own image. And after the step of cloning kaldi, the buildin process break in the make. Here are a snapshot of my terminal:

---> Running in b43424061057
Cloning into 'kaldi'...
extras/check_dependencies.sh
extras/check_dependencies.sh: sox is not installed.
extras/check_dependencies.sh: we recommend that you run (our best guess):
sudo apt-get install sox
make: *** [check_required_programs] Error 1
Makefile:31: recipe for target 'check_required_programs' failed
The command '/bin/sh -c git clone https://github.com/kaldi-asr/kaldi && cd /opt/kaldi/tools && make && ./install_portaudio.sh && cd /opt/kaldi/src && ./configure --shared && sed -i '/-g # -O0 -DKALDI_PARANOID/c-O3 -DNDEBUG' kaldi.mk && make depend && make && cd /opt/kaldi/src/online && make depend && make && cd /opt/kaldi/src/gst-plugin && make depend && make && cd /opt && git clone https://github.com/alumae/gst-kaldi-nnet2-online.git && cd /opt/gst-kaldi-nnet2-online/src && sed -i '/KALDI_ROOT?=/home/tanel/tools/kaldi-trunk/c\KALDI_ROOT?=/opt/kaldi' Makefile && make depend && make && rm -rf /opt/gst-kaldi-nnet2-online/.git/ && find /opt/gst-kaldi-nnet2-online/src/ -type f -not -name '.so' -delete && rm -rf /opt/kaldi/.git && rm -rf /opt/kaldi/egs/ /opt/kaldi/windows/ /opt/kaldi/misc/ && find /opt/kaldi/src/ -type f -not -name '.so' -delete && find /opt/kaldi/tools/ -type f ( -not -name '.so' -and -not -name '.so*' ) -delete && cd /opt && git clone https://github.com/alumae/kaldi-gstreamer-server.git && rm -rf /opt/kaldi-gstreamer-server/.git/ && rm -rf /opt/kaldi-gstreamer-server/test/' returned a non-zero code: 2

Modelo Portugues

José, ví que voce é aqui do Brasil, tenho interesse em compor um modelo brasileiro, em que eu poderia ajudar para termos esse material, eu estou lendo a documentação do kaldi agora então sou novo nisso, tentei fazer um modelo para o cmuphinix mas não tive bons resultados , estou a disposição para conversamos.
Desde já agradeço

Decoder processes terminating prematurely

Hi Silva,
Thanks a lot for the great work on the docker image which I have been experimenting for some time now.

The problem I am experiencing is that the worker process tends to terminate mysteriously after sustained usage for some time (say 1000 calls to the ASR server from another process from a web server) and the Python server usually returns the following error message:

Received error from server (status 9)
Error message: No decoder available, try again later

The last few lines from the worker.log file give the following:

2016-08-31 08:01:46 -   DEBUG:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Checking that decoder hasn't been silent for more than 10 seconds
2016-08-31 08:01:47 -   DEBUG:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Checking that decoder hasn't been silent for more than 10 seconds
2016-08-31 08:01:48 - WARNING:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: More than 10 seconds from last decoder hypothesis update, cancelling
2016-08-31 08:01:48 -    INFO:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Master disconnected before decoder reached EOS?
2016-08-31 08:01:48 -    INFO:   decoder2: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Sending EOS to pipeline in order to cancel processing
2016-08-31 08:01:48 -    INFO:   decoder2: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Cancelled pipeline
2016-08-31 08:01:48 -    INFO:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Waiting for EOS from decoder
ERROR (CopyRowsFromVec():kaldi-matrix.cc:864) Wrong sized arguments
2016-08-31 08:01:49 -   DEBUG:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2016-08-31 08:01:49 -    INFO:   __main__: ee8f8e2e-3678-43ea-a3b8-1789becf434c: Ignoring data, worker already in state 8
WARNING (RunNnetEvaluation():online-nnet2-decoding-threaded.cc:390) Caught exception: ERROR (CopyRowsFromVec():kaldi-matrix.cc:864) Wrong sized arguments

[stack trace: ]
kaldi::KaldiGetStackTrace()
kaldi::KaldiErrorMessage::~KaldiErrorMessage()
kaldi::MatrixBase<float>::CopyRowsFromVec(kaldi::VectorBase<float> const&)
kaldi::nnet2::NnetOnlineComputer::Flush(kaldi::CuMatrix<float>*)
kaldi::SingleUtteranceNnet2DecoderThreaded::RunNnetEvaluationInternal()
kaldi::SingleUtteranceNnet2DecoderThreaded::RunNnetEvaluation(void*)
/lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4) [0x7f78419670a4]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f7840d7904d]
ERROR (WaitForAllThreads():online-nnet2-decoding-threaded.cc:426) Error encountered during decoding.  See above.
terminate called after throwing an instance of 'std::runtime_error'
  what():  ERROR (WaitForAllThreads():online-nnet2-decoding-threaded.cc:426) Error encountered during decoding.  See above.

[stack trace: ]
kaldi::KaldiGetStackTrace()
kaldi::KaldiErrorMessage::~KaldiErrorMessage()
kaldi::SingleUtteranceNnet2DecoderThreaded::WaitForAllThreads()
kaldi::SingleUtteranceNnet2DecoderThreaded::Wait()
/opt/gst-kaldi-nnet2-online/src/libgstkaldionline2.so(+0x53b6d) [0x7f783bb28b6d]
/opt/gst-kaldi-nnet2-online/src/libgstkaldionline2.so(+0x54ac6) [0x7f783bb29ac6]
/usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0(+0x94ad6) [0x7f783db78ad6]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x712c8) [0x7f783f6ab2c8]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x70935) [0x7f783f6aa935]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4) [0x7f78419670a4]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f7840d7904d]

I have tried starting two workers, but the problems persist. What can be done to ensure the stable running of the docker server?

Victor

No decoder available, try again later

Hello, thank you for this project. I am having a problem with the Practical Example. I instantiated the server worker on the same machine and I then started the service. However, every time I invoke python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 32000 /tmp/1272-128104-0000.wav ; I get the error message No decoder available, try again later. Can you help me getting the example to work?

Gstreamer server getting stuck while display "Audio sent, now sending EOS" message

I have trained Amharic model which I want to use for speech recognition. I was able to successfully setup the kaldi-gstreamer server by following the instruction in the README file. However, when I try to get text transcribtion, it gets stuck by display the message "Audio sent, now sending EOS". I waited for several hours and still it is not showing anything change. So I stopped it forcefully. What is going wrong here?

Here is the command I ran:
python /tmp/client.py -u ws://localhost:8181/client/ws/speech -r 32768 /tmp/amh_test.wav

ImportError: No module named ws4py.client.threadedclient

Hi I was trying to running the example script, I have docker installed correctly and running the
"jcsilva/docker-kaldi-gstreamer-server:latest" image

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b14dcb974c8 jcsilva/docker-kaldi-gstreamer-server:latest "/bin/bash" 3 minutes ago Up 3 minutes 0.0.0.0:8081->80/tcp clever_spence

I also run the following command inside the docker image:
root@1b14dcb974c8:/opt# /opt/start.sh -y /opt/models/sample_english_nnet2.yaml

While I am trying to test the web client in my Host OS (Mac OS X) with these scripts:
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/kaldigstserver/client.py -P /tmp
wget https://raw.githubusercontent.com/jcsilva/docker-kaldi-gstreamer-server/master/audio/1272-128104-0000.wav -P /tmp
wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/test/data/bill_gates-TED.mp3 -P /tmp

python /tmp/client.py -u ws://localhost:8081/client/ws/speech -r 32000 /tmp/1272-128104-0000.wav
python /tmp/client.py -u ws://localhost:8081/client/ws/speech -r 8192 /tmp/bill_gates-TED.mp3

However,
The following problem appears:
$ python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 8192 /tmp/bill_gates-TED.mp3
Traceback (most recent call last):
File "/tmp/client.py", line 4, in
from ws4py.client.threadedclient import WebSocketClient
ImportError: No module named ws4py.client.threadedclient
cei-mac02:~ xiaotingfu$ python /tmp/client.py -u ws://localhost:8081/client/ws/speech -r 8192 /tmp/bill_gates-TED.mp3
Traceback (most recent call last):
File "/tmp/client.py", line 4, in
from ws4py.client.threadedclient import WebSocketClient
ImportError: No module named ws4py.client.threadedclient

(I also install ws4py as instructed)
$ pip install --user ws4py==0.3.2
Requirement already satisfied: ws4py==0.3.2 in ./Library/Python/3.6/lib/python/site-packages (0.3.2)

Can you help me with that? Do you think is that because my pip is connected to python3?

Need to specify the shm-size for docker

First off thanks for the docker file. It has really saved me a lot of time, while truing to get Kaldi up and running quickly.
I tried the practical end to end example, but I keep getting a 'No decoder found' when I uploaded a file to the master. I solved this by setting --shm-size=256m on the docker run command. I am not sure if this should be part of the instructions by default, or maybe part of a troubleshooting section, but I thought it would be helpful.

Worker fails loading Tedlium s5_r2 chain model ("Unknown component type TdnnComponent")

I have trained the Tedlium s5_r2 model from Kaldi. Decoding on the test set works without problems, as does decoding audio using the model and the online2-wav-nnet3-latgen-faster binary from Kaldi.

When trying to load the model in the server I get the following error:

...
2019-01-10 13:25:59 - INFO: decoder2: Setting decoder property: frame-subsampling-factor = 3
2019-01-10 13:25:59 - INFO: decoder2: Setting decoder property: phone-syms = models/tedlium_en_extended/decoding/phones.txt
2019-01-10 13:25:59 - INFO: decoder2: Setting decoder property: max-active = 7000
2019-01-10 13:25:59 - INFO: decoder2: Setting decoder property: chunk-length-in-secs = 0.25
2019-01-10 13:25:59 - INFO: decoder2: Setting decoder property: fst = models/tedlium_en_extended/decoding/HCLG.fst
2019-01-10 13:26:00 - INFO: decoder2: Setting decoder property: model = models/tedlium_en_extended/decoding/final.mdl
ERROR ([5.4.176~1-be967]:ReadNew():nnet-component-itf.cc:86) Unknown component type TdnnComponent

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::nnet3::Component::ReadNew(std::istream&, bool)
kaldi::nnet3::Nnet::Read(std::istream&, bool)
kaldi::nnet3::AmNnetSimple::Read(std::istream&, bool)

g_object_set_property

PyEval_EvalFrameEx
.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx
python() [0x50160f]
PyRun_FileExFlags
PyRun_SimpleFileExFlags
Py_Main
__libc_start_main
python() [0x497b8b]
...

The worker then fails to decode audio. I have used GStreamer Server with a self trained chain model from https://github.com/uhh-lt/kaldi-tuda-de/ without problems.

The YAML file used for starting:

use-nnet2: True
decoder:
nnet-mode: 3
use-threaded-decoder: True
model : models/tedlium_en_extended/decoding/final.mdl
word-syms : models/tedlium_en_extended/decoding/words.txt
fst : models/tedlium_en_extended/decoding/HCLG.fst
# feature-type : "mfcc"
mfcc-config : models/tedlium_en_extended/decoding/conf/mfcc.conf
frame-subsampling-factor: 3
ivector-extraction-config : models/tedlium_en_extended/decoding/conf/ivector_extractor.conf
# max-active: 10000
# beam: 10.0
max-active: 7000
beam: 15.0
lattice-beam: 6.0
acoustic-scale: 1.0 #0.083
do-endpointing : true
endpoint-silence-phones : "1:2:3:4:5:6:7:8:9:10"
traceback-period-in-secs: 0.25
chunk-length-in-secs: 0.25
num-nbest: 10
#Additional functionality that you can play with:
#lm-fst: test/models/english/librispeech_nnet_a_online/G.fst
#big-lm-const-arpa: test/models/english/librispeech_nnet_a_online/G.carpa
phone-syms: models/tedlium_en_extended/decoding/phones.txt
#word-boundary-file: models/newModel/de_350k_nnet3chain_tdnn1f_1024_sp_bi/phones/word_boundary.int
#do-phone-alignment: true
out-dir: tmp

use-vad: False
silence-timeout: 2

full-post-processor: kaldi-gstreamer-server/post_processor.py

logging:
version : 1
disable_existing_loggers: False
formatters:
simpleFormater:
format: '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
formatter: simpleFormater
level: DEBUG
root:
level: DEBUG
handlers: [console]

Any help is much appreciated!

Edit:
The respective code has been added to Kaldi on 07.07.2017. Might the prepared docker image be older than this and not contain the respective code changes from Kaldi?

Failing worker

Hi,
I'm trying to start the server inside the container, but worker fails.
That's what I have in worker.log:

libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
libdc1394 error: Failed to initialize libdc1394
   DEBUG 2018-10-17 15:07:51,451 Starting up worker
2018-10-17 15:07:51 -    INFO:    decoder: Creating decoder using conf: {'timeout-decoder': 10, 'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'decoder': {'word-syms': '/opt/kaldi_models/en/yes_no/words.txt', 'model': '/opt/kaldi_models/en/yes_no/final.mdl', 'fst': '/opt/kaldi_models/en/yes_no/HCLG.fst'}, 'silence-timeout': 60, 'out-dir': '/tmp', 'use-vad': False}
2018-10-17 15:07:51 -    INFO:    decoder: Setting decoder property: word-syms = /opt/kaldi_models/en/yes_no/words.txt
2018-10-17 15:07:51 -    INFO:    decoder: Setting decoder property: model = /opt/kaldi_models/en/yes_no/final.mdl
2018-10-17 15:07:51 -    INFO:    decoder: Setting decoder property: fst = /opt/kaldi_models/en/yes_no/HCLG.fst
2018-10-17 15:07:51 -    INFO:    decoder: Created GStreamer elements
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstAppSrc object at 0x7f4b89f0f320 (GstAppSrc at 0x1fb07b0)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstDecodeBin object at 0x7f4b89f0f2d0 (GstDecodeBin at 0x2022060)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstAudioConvert object at 0x7f4b89f0f4b0 (GstAudioConvert at 0x202b8f0)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstAudioResample object at 0x7f4b89f0f410 (GstAudioResample at 0x1e1af70)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstTee object at 0x7f4b89f0f460 (GstTee at 0x2039000)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstQueue object at 0x7f4b89f0f550 (GstQueue at 0x203c170)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstFileSink object at 0x7f4b89f0f5a0 (GstFileSink at 0x2040400)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstQueue object at 0x7f4b89f0f5f0 (GstQueue at 0x203c460)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstCutter object at 0x7f4b89f0f640 (GstCutter at 0x2046010)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstOnlineGmmDecodeFaster object at 0x7f4b89f0f690 (GstOnlineGmmDecodeFaster at 0x2057000)> to the pipeline
2018-10-17 15:07:51 -   DEBUG:    decoder: Adding <__main__.GstFakeSink object at 0x7f4b89f0f6e0 (GstFakeSink at 0x1e7ea10)> to the pipeline
2018-10-17 15:07:51 -    INFO:    decoder: Linking GStreamer elements
2018-10-17 15:07:51 -    INFO:    decoder: Setting pipeline to READY
ERROR ([5.4.176~1-be967]:Input():kaldi-io.cc:756) Error opening input stream /opt/kaldi_models/en/yes_no/final.mdl

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::Input::Input(std::string const&, bool*)

gst_element_change_state


gst_element_change_state

ffi_call_unix64
.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx
python() [0x50160f]
PyRun_FileExFlags
PyRun_SimpleFileExFlags
Py_Main
__libc_start_main
python() [0x497b8b]

terminate called after throwing an instance of 'std::runtime_error'
  what():

I thoght that I have the same problem as in #4 but attempt to run the server with yes_no model from the issue above gives the same error.

not seeing any output

Hi Eduardo,

I am trying to run your docker sample but am stuck at the following command:

docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash

not sure what the output of the above command should be. it just sits there without outputting anything? is it expecting any input at this point? is this the docker container?

and a question about the next command:

/opt/start.sh -y /opt/models/nnet2.yaml

so what step will put the start.sh file in the /opt dir?

i downloaded the models(tedlium_nnet_ms_sp_online.tgz) using the commands from the examples/practical-example subdir.

it downloded the tedlium english crpus. i put them in /media/kaldi_models as sugeested by ur documentation.

am i doing it wrong?

thanks

Connection refused problem

Hi,
I have made everything as described in the practical example.
When I use the websocket client and check for status I get the appropriate answer, but when I apply:

python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 32000 /tmp/1272-128104-0000.wav

I get the following exception:

Traceback (most recent call last):
File "/tmp/client.py", line 127, in
main()
File "/tmp/client.py", line 122, in main
ws.connect()
File "/usr/local/lib/python2.7/dist-packages/ws4py/client/init.py", line 209, in connect
self.sock.connect(self.bind_addr)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused

Any help would be appreciated.

Worker - Couldn't connect to server, waiting for 5 seconds

Hello,

First of all, huge thank you for this docker image. I really appreciate you sharing this with the community, you deserve lot's of credits for this.

I do have an issue when testing my setup. When I use the test command from my host:

python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 8192 /tmp/bill_gates-TED.mp3

Nothing happens, the process just stays stuck and I have to kill it manually. If I do wait for long enough, I get the following error:

Traceback (most recent call last):
  File "/tmp/client.py", line 127, in <module>
    main()
  File "/tmp/client.py", line 122, in main
    ws.connect()
  File "/home/nasadmin/.local/lib/python2.7/site-packages/ws4py/client/__init__.py", line 216, in connect
    bytes = self.sock.recv(128)
socket.error: [Errno 104] Connection reset by peer

Here is my worker.log file after the above attempt:

   DEBUG 2016-11-24 12:02:17,217 Starting up worker
2016-11-24 12:02:17 -    INFO:   decoder2: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-vad': False, 'decoder': {'ivector-extraction-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/ivector_extractor.conf', 'num-nbest': 10, 'lattice-beam': 6.0, 'acoustic-scale': 0.083, 'do-endpointing': True, 'beam': 10.0, 'max-active': 10000, 'fst': '/opt/models/english/tedlium_nnet_ms_sp_online/HCLG.fst', 'mfcc-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/mfcc.conf', 'use-threaded-decoder': True, 'traceback-period-in-secs': 0.25, 'model': '/opt/models/english/tedlium_nnet_ms_sp_online/final.mdl', 'word-syms': '/opt/models/english/tedlium_nnet_ms_sp_online/words.txt', 'endpoint-silence-phones': '1:2:3:4:5:6:7:8:9:10', 'chunk-length-in-secs': 0.25}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-nnet2': True}
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'delta'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'max-mem'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'phone-determinize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'word-determinize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'minimize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'beam'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'max-active'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'min-active'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'lattice-beam'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'prune-interval'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'determinize-lattice'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'beam-delta'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'hash-ratio'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'acoustic-scale'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: ivector-extraction-config = /opt/models/english/tedlium_nnet_ms_sp_online/conf/ivector_extractor.conf
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: num-nbest = 10
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: lattice-beam = 6.0
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: acoustic-scale = 0.083
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: do-endpointing = True
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: beam = 10.0
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: max-active = 10000
2016-11-24 12:02:17 -    INFO:   decoder2: Setting decoder property: fst = /opt/models/english/tedlium_nnet_ms_sp_online/HCLG.fst
2016-11-24 12:02:22 -    INFO:   decoder2: Setting decoder property: mfcc-config = /opt/models/english/tedlium_nnet_ms_sp_online/conf/mfcc.conf
2016-11-24 12:02:22 -    INFO:   decoder2: Setting decoder property: traceback-period-in-secs = 0.25
2016-11-24 12:02:22 -    INFO:   decoder2: Setting decoder property: model = /opt/models/english/tedlium_nnet_ms_sp_online/final.mdl
2016-11-24 12:02:22 -    INFO:   decoder2: Setting decoder property: word-syms = /opt/models/english/tedlium_nnet_ms_sp_online/words.txt
2016-11-24 12:02:23 -    INFO:   decoder2: Setting decoder property: endpoint-silence-phones = 1:2:3:4:5:6:7:8:9:10
2016-11-24 12:02:23 -    INFO:   decoder2: Setting decoder property: chunk-length-in-secs = 0.25
2016-11-24 12:02:23 -    INFO:   decoder2: Created GStreamer elements
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstAppSrc object at 0x7f6f5bdb5410 (GstAppSrc at 0x10771b0)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstDecodeBin object at 0x7f6f5bdb5320 (GstDecodeBin at 0x106a090)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstAudioConvert object at 0x7f6f5bdb52d0 (GstAudioConvert at 0x108ba60)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstAudioResample object at 0x7f6f5bdb53c0 (GstAudioResample at 0xf26770)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstTee object at 0x7f6f5bdb5280 (GstTee at 0x109c000)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstQueue object at 0x7f6f5bdb5370 (GstQueue at 0x10a0210)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstFileSink object at 0x7f6f5bdb5460 (GstFileSink at 0x10a4800)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstQueue object at 0x7f6f5bdb54b0 (GstQueue at 0x10a0500)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.Gstkaldinnet2onlinedecoder object at 0x7f6f5bd64320 (Gstkaldinnet2onlinedecoder at 0x1071c70)> to the pipeline
2016-11-24 12:02:23 -   DEBUG:   decoder2: Adding <__main__.GstFakeSink object at 0x7f6f5bd64370 (GstFakeSink at 0xfae200)> to the pipeline
2016-11-24 12:02:23 -    INFO:   decoder2: Linking GStreamer elements
LOG (ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG (ComputeDerivedVars():ivector-extractor.cc:204) Done.
2016-11-24 12:02:23 -    INFO:   decoder2: Setting pipeline to READY
2016-11-24 12:02:23 -    INFO:   decoder2: Set pipeline to READY
2016-11-24 12:02:23 -    INFO:   __main__: Opening websocket connection to master server
2016-11-24 12:02:23 -    INFO:   __main__: Opened websocket connection to server

I followed your instructions to the letter, did I miss something?

Just in case, here is my master.log file as well

DEBUG 2016-11-24 12:02:17,218 Starting up server
    INFO 2016-11-24 12:02:23,587 New worker available <__main__.WorkerSocketHandler object at 0x7f8b60739b90>

I started the Docker image as such:

docker run -it -p 8080:80 -v /media/kaldi_models:/opt/models jcsilva/docker-kaldi-gstreamer-server:latest /bin/bash

It looks like I am almost there, any suggestions would be very much appreciated.

Thanks,

Michael

Kaldi now requires python3 in addition to python2.7

Since recently, python3 is now required by Kaldi check_dependencies.sh script (see kaldi-asr/kaldi@8ad898c).

Consequently, trying to build the image from scratch will fail at step 6 due to the fact that the python3 package is not installed.
Adding python3 to the list of installed packages is needed to fix this.


Error log:

Step 6/8 : RUN git clone https://github.com/kaldi-asr/kaldi &&     cd /opt/kaldi/tools &&     make &&     ./install_portaudio.sh &&     cd /opt/kaldi/src && ./configure --shared &&     sed -i '/-g # -O0 -DKALDI_PARANOID/c\-O3 -DNDEBUG' kaldi.mk &&     make depend && make &&     cd /opt/kaldi/src/online && make depend && make &&     cd /opt/kaldi/src/gst-plugin && make depend && make &&     cd /opt &&     git clone https://github.com/alumae/gst-kaldi-nnet2-online.git &&     cd /opt/gst-kaldi-nnet2-online/src &&     sed -i '/KALDI_ROOT?=\/home\/tanel\/tools\/kaldi-trunk/c\KALDI_ROOT?=\/opt\/kaldi' Makefile &&     make depend && make &&     rm -rf /opt/gst-kaldi-nnet2-online/.git/ &&     find /opt/gst-kaldi-nnet2-online/src/ -type f -not -name '*.so' -delete &&     rm -rf /opt/kaldi/.git &&     rm -rf /opt/kaldi/egs/ /opt/kaldi/windows/ /opt/kaldi/misc/ &&     find /opt/kaldi/src/ -type f -not -name '*.so' -delete &&     find /opt/kaldi/tools/ -type f \( -not -name '*.so' -and -not -name '*.so*' \) -delete &&     cd /opt && git clone https://github.com/alumae/kaldi-gstreamer-server.git &&     rm -rf /opt/kaldi-gstreamer-server/.git/ &&     rm -rf /opt/kaldi-gstreamer-server/test/
 ---> Running in a75ba361cf20
Cloning into 'kaldi'...
extras/check_dependencies.sh
extras/check_dependencies.sh: python3 is not installed
extras/check_dependencies.sh: we recommend that you run (our best guess):
 sudo apt-get install  
Makefile:31: recipe for target 'check_required_programs' failed
make: *** [check_required_programs] Error 1
The command '/bin/sh -c git clone https://github.com/kaldi-asr/kaldi &&     cd /opt/kaldi/tools &&     make &&     ./install_portaudio.sh &&     cd /opt/kaldi/src && ./configure --shared &&     sed -i '/-g # -O0 -DKALDI_PARANOID/c\-O3 -DNDEBUG' kaldi.mk &&     make depend && make &&     cd /opt/kaldi/src/online && make depend && make &&     cd /opt/kaldi/src/gst-plugin && make depend && make &&     cd /opt &&     git clone https://github.com/alumae/gst-kaldi-nnet2-online.git &&     cd /opt/gst-kaldi-nnet2-online/src &&     sed -i '/KALDI_ROOT?=\/home\/tanel\/tools\/kaldi-trunk/c\KALDI_ROOT?=\/opt\/kaldi' Makefile &&     make depend && make &&     rm -rf /opt/gst-kaldi-nnet2-online/.git/ &&     find /opt/gst-kaldi-nnet2-online/src/ -type f -not -name '*.so' -delete &&     rm -rf /opt/kaldi/.git &&     rm -rf /opt/kaldi/egs/ /opt/kaldi/windows/ /opt/kaldi/misc/ &&     find /opt/kaldi/src/ -type f -not -name '*.so' -delete &&     find /opt/kaldi/tools/ -type f \( -not -name '*.so' -and -not -name '*.so*' \) -delete &&     cd /opt && git clone https://github.com/alumae/kaldi-gstreamer-server.git &&     rm -rf /opt/kaldi-gstreamer-server/.git/ &&     rm -rf /opt/kaldi-gstreamer-server/test/' returned a non-zero code: 2

No such element or plugin 'kaldinnet2onlinedecoder'

I compiled gst-kaldi-nnet2-online successful outside the docker, and then got correct result using gst-inspect-1.0 kaldinnet2onlinedecoder.

However, I copied the .so file to /media/kaldi-models/ and then added its path to GST_PLUGIN_PATH, then I got ERROR when using gst-inspect to check gst:

GStreamer-WARNING **: Failed to load plugin './libgstkaldinnet2onlinedecoder.so': libkaldi-online2.so: cannot open shared object file: No such file or directory
No such element or plugin 'kaldinnet2onlinedecoder'

Then I tried to copy $KALDI_ROOT/src/lib*.so to /media/kaldi-models/ and specified LD_LIBRARY_PATH, I still got ERROR:
No such element or plugin 'kaldinnet2onlinedecoder'

How to solve this problem please?

Failing worker when starting master and server

Hi,
Thank you for the image!
I have trouble going through the steps of testing namely starting the server inside the container.
When I do

/opt/start.sh -y /opt/models/sample_english_nnet2.yaml

I get the below in the worker.log:

root@83fb42059eaf:/opt#` cat worker.log
libdc1394 error: Failed to initialize libdc1394
   DEBUG 2016-04-12 10:17:39,582 Starting up worker
2016-04-12 10:17:39 -    INFO:   decoder2: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-vad': False, 'decoder': {'ivector-extraction-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/ivector_extractor.conf', 'num-nbest': 10, 'lattice-beam': 6.0, 'acoustic-scale': 0.083, 'do-endpointing': True, 'beam': 10.0, 'max-active': 10000, 'fst': '/opt/models/english/tedlium_nnet_ms_sp_online/HCLG.fst', 'mfcc-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/mfcc.conf', 'use-threaded-decoder': True, 'traceback-period-in-secs': 0.25, 'model': '/opt/models/english/tedlium_nnet_ms_sp_online/final.mdl', 'word-syms': '/opt/models/english/tedlium_nnet_ms_sp_online/words.txt', 'endpoint-silence-phones': '1:2:3:4:5:6:7:8:9:10', 'chunk-length-in-secs': 0.25}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-nnet2': True}
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'delta'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'max-mem'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'phone-determinize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'word-determinize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'minimize'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'beam'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'max-active'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'min-active'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'lattice-beam'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'prune-interval'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'determinize-lattice'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'beam-delta'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'hash-ratio'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py:48: Warning: When installing property: type 'Gstkaldinnet2onlinedecoder' already has a property named 'acoustic-scale'
  self.asr = Gst.ElementFactory.make("kaldinnet2onlinedecoder", "asr")
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: ivector-extraction-config = /opt/models/english/tedlium_nnet_ms_sp_online/conf/ivector_extractor.conf
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: num-nbest = 10
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: lattice-beam = 6.0
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: acoustic-scale = 0.083
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: do-endpointing = True
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: beam = 10.0
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: max-active = 10000
2016-04-12 10:17:39 -    INFO:   decoder2: Setting decoder property: fst = /opt/models/english/tedlium_nnet_ms_sp_online/HCLG.fst
**terminate called after throwing an instance of 'std::length_error'
  what():  vector::reserve**

I have tried increasing memory of the Virtual machine, and also building the image directly from the Git, but got the same result.

Could you please look into this?

thanks

Expected token "<BlockDim>", got instead "<BackpropScale>".

When I start the service ,the worker.log returns:
ERROR ([5.4.176~1-be967]:ExpectToken():io-funcs.cc:212) Expected token "", got instead "".

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::ExpectToken(std::istream&, bool, char const*)
kaldi::nnet3::NonlinearComponent::Read(std::istream&, bool)
kaldi::nnet3::Component::ReadNew(std::istream&, bool)
kaldi::nnet3::Nnet::Read(std::istream&, bool)
kaldi::nnet3::AmNnetSimple::Read(std::istream&, bool)

g_object_set_property

.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx

Is it because that the Kaldi version is not up to date?
Thank you!

Need script to download and install model files

Can you please consider providing either of these:

  • A script to download model files into the right directory
  • An option to just put the models inside the docker image

Otherwise there is still a lot of rummaging around to get started

How to scale the the docker so that multiple clients can connect to the ASR?

Hi Jcsilva

I am running your docker image in one of my compute engine with my models,and i am able to get the streaming work in my android app when i do websocket connection to the docker container.

But if i try to connect to my container with two or more android clients. I am not able to get streaming working.Only one connection can done to the socket.Only one connection works.

Only after that connection is released ,second connection works

How do i scale this docker so that 100s of websocket connection can be opened?

Thank you

Using a GMM (LDA+MLLT) model, worker terminates with "dimension mismatch" error

Using a GMM model with LDA+MLLT features (the model called "exp/tri2b" that is built using the "voxforge" example scripts), I get the following errors when I try to run a sample decode:

DEBUG 2017-05-05 02:52:26,526 Starting up worker
2017-05-05 02:52:26 - INFO: decoder: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-nnet2': False, 'full-post-processor': './sample_full_post_processor.py', 'decoder': {'word-syms': 'exp/tri2b/graph/words.txt', 'model': 'exp/tri2b/final.mdl', 'max-active': 10000, 'fst': 'exp/tri2b/graph/HCLG.fst', 'beam': 10.0}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-vad': False}
/bin/sh: ./sample_full_post_processor.py: No such file or directory
2017-05-05 02:52:26 - INFO: decoder: Setting decoder property: word-syms = exp/tri2b/graph/words.txt
2017-05-05 02:52:26 - INFO: decoder: Setting decoder property: model = exp/tri2b/final.mdl
2017-05-05 02:52:26 - INFO: decoder: Setting decoder property: max-active = 10000
2017-05-05 02:52:26 - INFO: decoder: Setting decoder property: fst = exp/tri2b/graph/HCLG.fst
2017-05-05 02:52:26 - INFO: decoder: Setting decoder property: beam = 10.0
2017-05-05 02:52:26 - INFO: decoder: Created GStreamer elements
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstAppSrc object at 0x7f2d795ed280 (GstAppSrc at 0x2ea51b0)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstDecodeBin object at 0x7f2d795ed230 (GstDecodeBin at 0x2eaa090)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstAudioConvert object at 0x7f2d795ed460 (GstAudioConvert at 0x2ebb140)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstAudioResample object at 0x7f2d795ed370 (GstAudioResample at 0x2d61a30)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstTee object at 0x7f2d795ed320 (GstTee at 0x2ecb000)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstQueue object at 0x7f2d795ed410 (GstQueue at 0x2ed0210)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstFileSink object at 0x7f2d795ed2d0 (GstFileSink at 0x2ed4000)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstQueue object at 0x7f2d795ed3c0 (GstQueue at 0x2ed0500)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstCutter object at 0x7f2d795ed4b0 (GstCutter at 0x2eda010)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstOnlineGmmDecodeFaster object at 0x7f2d795ed500 (GstOnlineGmmDecodeFaster at 0x2ef1000)> to the pipeline
2017-05-05 02:52:26 - DEBUG: decoder: Adding <main.GstFakeSink object at 0x7f2d795ed550 (GstFakeSink at 0x2dc7c40)> to the pipeline
2017-05-05 02:52:26 - INFO: decoder: Linking GStreamer elements
2017-05-05 02:52:26 - INFO: decoder: Setting pipeline to READY
2017-05-05 02:52:40 - INFO: decoder: Set pipeline to READY
2017-05-05 02:52:40 - INFO: main: Opening websocket connection to master server
2017-05-05 02:52:40 - INFO: main: Opened websocket connection to server
2017-05-05 02:53:11 - DEBUG: main: : Got message from server of type <class 'ws4py.messaging.TextMessage'>
2017-05-05 02:53:11 - INFO: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pipeline initialized
2017-05-05 02:53:11 - INFO: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Started timeout guard
2017-05-05 02:53:11 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Checking that decoder hasn't been silent for more than 10 seconds
2017-05-05 02:53:11 - INFO: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Initialized request
2017-05-05 02:53:11 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2017-05-05 02:53:11 - DEBUG: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pushing buffer of size 8000 to pipeline
2017-05-05 02:53:12 - INFO: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Connecting audio decoder
2017-05-05 02:53:12 - INFO: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Connected audio decoder
2017-05-05 02:53:12 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2017-05-05 02:53:12 - DEBUG: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pushing buffer of size 8000 to pipeline
2017-05-05 02:53:12 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2017-05-05 02:53:12 - DEBUG: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pushing buffer of size 8000 to pipeline
2017-05-05 02:53:12 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2017-05-05 02:53:12 - DEBUG: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pushing buffer of size 8000 to pipeline
2017-05-05 02:53:12 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Checking that decoder hasn't been silent for more than 10 seconds
2017-05-05 02:53:12 - DEBUG: main: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Got message from server of type <class 'ws4py.messaging.BinaryMessage'>
2017-05-05 02:53:12 - DEBUG: decoder: 73b78b7d-c605-4b97-a8f7-b9c196bfcfe8: Pushing buffer of size 8000 to pipeline
ERROR ([5.0.27~1-b9c1e]:LogLikelihoods():diag-gmm.cc:533) DiagGmm::ComponentLogLikelihood, dimension mismatch 39 vs. 40

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::DiagGmm::LogLikelihoods(kaldi::VectorBase const&, kaldi::Vector) const
kaldi::DiagGmm::LogLikelihood(kaldi::VectorBase const&) const
kaldi::OnlineDecodableDiagGmmScaled::LogLikelihood(int, int)
kaldi::FasterDecoder::ProcessEmitting(kaldi::DecodableInterface
)
kaldi::OnlineFasterDecoder::Decode(kaldi::DecodableInterface*)

clone

terminate called after throwing an instance of 'std::runtime_error'
what():

This thread in the old Kaldi lists on sourceforge suggests that the cause may be an out-of-date decoder version; is that a possibility here? Or is there some other cause?

Cannot run Practical Example

Inside worker.log , it is found:

Failed to send event to master: Cannot send on a terminated websocket

Why?

Background:

  1. I run client using "python /hdd/tommy/tmp/client.py -u ws://localhost:8080/client/ws/speech -r 8192 /hdd/tommy/tmp/bill_gates-TED.mp3"

  2. Status is RESPONSE: {"num_workers_available": 1, "num_requests_processed": 5}

  3. In worker.log, recognised text result is found in worker log, but it seems it cannot be returned from worker back to master, and then back to client.

Thanks in advance

Yaml File for LibriSpeech and VoxForge Corpus of Kaldi

I have trained kaldi with API.AI & Voxforge coprus and LibriSpeech Corpus and the mdl files have been generated.

Please can anyone help me with how to modify the Sample YAML to include these corpus.

And is there a seperate YAML file for CHAIN MODELS

connection server time out

hello .. i tried your Practical Example and it works fine ... the docker-kaldi-gstreamer-server works fine when i tried with a local server .. so when i move to a my android and i wanna tested like the exp with knoele there's no connection betwen the android client and the server ??

Can't run worker.py - terminating with runtimeerror

Hi,
Thanks a lot for putting this up - much appreciated.

I'm running into this weird runtime error when running the worker.py. (Note master.py works fine).

Here's my worker.log snippet (please let me know if you see anything obvious):

2019-02-21 08:56:32 - INFO: decoder2: Created GStreamer elements
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstAppSrc object at 0x7fa52d7e83c0 (GstAppSrc at 0x1a873b0)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstDecodeBin object at 0x7fa52d7e8500 (GstDecodeBin at 0x1aec060)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstAudioConvert object at 0x7fa52d7e8370 (GstAudioConvert at 0x1af50d0)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstAudioResample object at 0x7fa52d7e84b0 (GstAudioResample at 0x18e1f70)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstTee object at 0x7fa52d7e8410 (GstTee at 0x1b03000)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstQueue object at 0x7fa52d7e8460 (GstQueue at 0x1b06170)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstFileSink object at 0x7fa52d7e8550 (GstFileSink at 0x1b09c00)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstQueue object at 0x7fa52d7e85a0 (GstQueue at 0x1b06460)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.Gstkaldinnet2onlinedecoder object at 0x7fa52d7e85f0 (Gstkaldinnet2onlinedecoder at 0x1b22150)> to the pipeline
2019-02-21 08:56:32 - DEBUG: decoder2: Adding <main.GstFakeSink object at 0x7fa52d7e8640 (GstFakeSink at 0x1b21a10)> to the pipeline
2019-02-21 08:56:32 - INFO: decoder2: Linking GStreamer elements
ERROR ([5.4.176~1-be967]:ReadConfigFile():parse-options.cc:469) Cannot open config file: tedlium_nnet_ms_sp_online/conf/mfcc.conf

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::ParseOptions::ReadConfigFile(std::string const&)
void kaldi::ReadConfigFromFilekaldi::MfccOptions(std::string, kaldi::MfccOptions*)
kaldi::OnlineNnet2FeaturePipelineInfo::OnlineNnet2FeaturePipelineInfo(kaldi::OnlineNnet2FeaturePipelineConfig const&)

gst_pad_query
gst_pad_query_caps
gst_element_get_compatible_pad
gst_element_link_pads_full
.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx
python() [0x50160f]
PyRun_FileExFlags
PyRun_SimpleFileExFlags
Py_Main
__libc_start_main
python() [0x497b8b]

terminate called after throwing an instance of 'std::runtime_error'

trouble getting to solve worker.log file in kaldi with docker and gstreamer

Dear jcsilva
Greetings ......
Currently, I am working on KALDI with docker and gstreamer. I am following your's repository and " https://medium.com/@nikhilamunipalli/simple-guide-to-kaldi-an-efficient-open-source-speech-recognition-tool-for-extreme-beginners-98a48bb34756" this link.
after running " ./start.sh -y opt/models/nnet2.yaml " command, I am checking the worker.log
worker.log
file. There I am getting some errors. Here I am attaching the worker.log file too. Kindly guide me in this regard.

libdc1394 error: Failed to initialize libdc1394 when run in docker

when run in docker
the worker.log show :
libdc1394 error: Failed to initialize libdc1394
DEBUG 2017-07-19 10:15:49,697 Starting up worker
2017-07-19 10:15:49 - INFO: decoder2: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-vad': False, 'decoder': {'ivector-extraction-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/ivector_extractor.conf', 'num-nbest': 10, 'lattice-beam': 6.0, 'acoustic-scale': 0.083, 'do-endpointing': True, 'beam': 10.0, 'max-active': 10000, 'fst': '/opt/models/english/tedlium_nnet_ms_sp_online/HCLG.fst', 'mfcc-config': '/opt/models/english/tedlium_nnet_ms_sp_online/conf/mfcc.conf', 'use-threaded-decoder': True, 'traceback-period-in-secs': 0.25, 'model': '/opt/models/english/tedlium_nnet_ms_sp_online/final.mdl', 'word-syms': '/opt/models/english/tedlium_nnet_ms_sp_online/words.txt', 'endpoint-silence-phones': '1:2:3:4:5:6:7:8:9:10', 'chunk-length-in-secs': 0.25}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-nnet2': True}
how to sovled it.

unknown instruction: <!DOCTYPE

After running docker I have a following error

Error response from daemon: Dockerfile parse error line 7: unknown instruction: <!DOCTYPE

I am using macOS

How would I start multiple workers and connect them to a master?

Hello,

How would I start multiple workers and connect them to a single master?

I've tried adding multiple worker start lines to the start.sh, but it does not seem to work

python /opt/kaldi-gstreamer-server/kaldigstserver/worker.py -c $YAML -u ws://$MASTER:$PORT/worker/ws/speech 2>> /opt/worker.log &

Thank You

Received error from server (status 9)

Got this error message:
python /tmp/client.py -u ws://localhost:8080/client/ws/speech -r 32000 /tmp/1272-128104-0000.wav
Received error from server (status 9)
Error message: No decoder available, try again later

How to solve this?

  • Check that .yaml and .conf files have been set to correct path

Any news on PT-BR recognition?

Hello,
I'm from Brazil too and wanted to build voice interfaces that worked offline for robots in Portuguese. However, I couldn't find any good solution that works offline and continuously. So, I'd like to know if there's any news or links for a Brazilian Portuguese model.

Missing license

Would you mind adding a license file to this repo?
ideally something similar to kaldi-gstreamer-server's license (BSD 2-clause "Simplified" License)

running ASpIRE Chain Model

Hi,
first of all thank you a lot for this project!

It would be just awesome to configure this docker for "state-of-the-art" ASpIRE Chain Model.
I'm trying to configure it but so far it's quite confusing for me.

Any tips for that?

The best wishes,
Aleksei

Docker image won't build with current version of Kaldi

The docker built fails when Kaldi executes "check_dependencies.sh" because the Docker image lacks "unzip". The Dockerfile needs to be modified to this:

`
FROM debian:8
MAINTAINER Eduardo Silva [email protected]

RUN apt-get update && apt-get install -y
autoconf
automake
bzip2
g++
git
gstreamer1.0-plugins-good
gstreamer1.0-tools
gstreamer1.0-pulseaudio
gstreamer1.0-plugins-bad
gstreamer1.0-plugins-base
gstreamer1.0-plugins-ugly
libatlas3-base
libgstreamer1.0-dev
libtool-bin
make
python2.7
python3
python-pip
python-yaml
python-simplejson
python-gi
subversion
unzip
wget
build-essential
python-dev
sox
zlib1g-dev &&
apt-get clean autoclean &&
apt-get autoremove -y &&
pip install ws4py==0.3.2 &&
pip install tornado &&
ln -s /usr/bin/python2.7 /usr/bin/python ; ln -s -f bash /bin/sh

WORKDIR /opt

RUN wget http://www.digip.org/jansson/releases/jansson-2.7.tar.bz2 &&
bunzip2 -c jansson-2.7.tar.bz2 | tar xf - &&
cd jansson-2.7 &&
./configure && make && make check && make install &&
echo "/usr/local/lib" >> /etc/ld.so.conf.d/jansson.conf && ldconfig &&
rm /opt/jansson-2.7.tar.bz2 && rm -rf /opt/jansson-2.7

RUN git clone https://github.com/kaldi-asr/kaldi &&
cd /opt/kaldi/tools &&
make &&
./install_portaudio.sh &&
cd /opt/kaldi/src && ./configure --shared &&
sed -i '/-g # -O0 -DKALDI_PARANOID/c-O3 -DNDEBUG' kaldi.mk &&
make depend && make &&
cd /opt/kaldi/src/online && make depend && make &&
cd /opt/kaldi/src/gst-plugin && make depend && make &&
cd /opt &&
git clone https://github.com/alumae/gst-kaldi-nnet2-online.git &&
cd /opt/gst-kaldi-nnet2-online/src &&
sed -i '/KALDI_ROOT?=/home/tanel/tools/kaldi-trunk/c\KALDI_ROOT?=/opt/kaldi' Makefile &&
make depend && make &&
rm -rf /opt/gst-kaldi-nnet2-online/.git/ &&
find /opt/gst-kaldi-nnet2-online/src/ -type f -not -name '.so' -delete &&
rm -rf /opt/kaldi/.git &&
rm -rf /opt/kaldi/egs/ /opt/kaldi/windows/ /opt/kaldi/misc/ &&
find /opt/kaldi/src/ -type f -not -name '
.so' -delete &&
find /opt/kaldi/tools/ -type f ( -not -name '.so' -and -not -name '.so*' ) -delete &&
cd /opt && git clone https://github.com/alumae/kaldi-gstreamer-server.git &&
rm -rf /opt/kaldi-gstreamer-server/.git/ &&
rm -rf /opt/kaldi-gstreamer-server/test/

COPY start.sh stop.sh /opt/

RUN chmod +x /opt/start.sh &&
chmod +x /opt/stop.sh
`

Error opening input stream

I keep getting a runtime error and the service keeps shutting down. I have described what I did below.

The README said to get my own kaldi model and must have a yaml file that describes the model. So I got a this model tedlium-nnet2, and put it inside /media/kaldi_models , which is mirrored in /opt/models in the docker container.

So my model english lives at /opt/models/english.

For the yaml file, I copied the 3rd one in your example from here and changed all the test/models/english to just english, and renamed it to nnet2.yaml.

I also copied the sample_full_post_processor.py file from alumae/kaldi-gstreamer-server/master/ because the yaml file required it.

But when I start the service using the command /opt/start.sh -y /opt/models/nnet2.yaml, I get this error Error opening input stream test/models/english/tedlium_nnet_ms_sp_online/ivector_extractor/final.mat. Since I refactored all the paths, why is it still looking under test/models?

See the worker log below.

2018-12-09 06:04:28 -    INFO:   decoder2: Created GStreamer elements
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstAppSrc object at 0x7f9e215e6550 (GstAppSrc at 0x160a1b0)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstDecodeBin object at 0x7f9e215e6370 (GstDecodeBin at 0x1620090)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstAudioConvert object at 0x7f9e215e6320 (GstAudioConvert at 0x162bee0)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstAudioResample object at 0x7f9e215e6500 (GstAudioResample at 0x14e8bd0)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstTee object at 0x7f9e215e6460 (GstTee at 0x163c000)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstQueue object at 0x7f9e215e64b0 (GstQueue at 0x1640210)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstFileSink object at 0x7f9e215e65a0 (GstFileSink at 0x1644c00)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstQueue object at 0x7f9e215e65f0 (GstQueue at 0x1640500)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.Gstkaldinnet2onlinedecoder object at 0x7f9e215e6640 (Gstkaldinnet2onlinedecoder at 0x16660a0)> to the pipeline
2018-12-09 06:04:28 -   DEBUG:   decoder2: Adding <__main__.GstFakeSink object at 0x7f9e215e6690 (GstFakeSink at 0x1541200)> to the pipeline
2018-12-09 06:04:28 -    INFO:   decoder2: Linking GStreamer elements
ERROR ([5.4.176~1-be967]:Input():kaldi-io.cc:756) Error opening input stream test/models/english/tedlium_nnet_ms_sp_online/ivector_extractor/final.mat

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::Input::Input(std::string const&, bool*)
void kaldi::ReadKaldiObject<kaldi::Matrix<float> >(std::string const&, kaldi::Matrix<float>*)
kaldi::OnlineIvectorExtractionInfo::Init(kaldi::OnlineIvectorExtractionConfig const&)
kaldi::OnlineNnet2FeaturePipelineInfo::OnlineNnet2FeaturePipelineInfo(kaldi::OnlineNnet2FeaturePipelineConfig const&)

gst_pad_query
gst_pad_query_caps
gst_element_get_compatible_pad
.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx
python() [0x50160f]
PyRun_FileExFlags
PyRun_SimpleFileExFlags
Py_Main
__libc_start_main
python() [0x497b8b]

terminate called after throwing an instance of 'std::runtime_error'
  what():

Error trying to build docker image

Got an error trying to build the docker image for practical-example.

Linux hostname 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Command ran:
docker build -t docker-kaldi-gstreamer-example:latest .

Error log:
Sending build context to Docker daemon 728.5 MB
Step 1/5 : RUN mkdir -p /opt/models && cd /opt/models && wget https://phon.ioc.ee/~tanela/tedlium_nnet_ms_sp_online.tgz && tar -zxvf tedlium_nnet_ms_sp_online.tgz && wget https://raw.githubusercontent.com/alumae/kaldi-gstreamer-server/master/sample_english_nnet2.yaml -P /opt/models && find /opt/models/ -type f | xargs sed -i 's:test:/opt:g' && sed -i 's:full-post-processor:#full-post-processor:g' /opt/models/sample_english_nnet2.yaml
Please provide a source image with from prior to run
[gfsitman@sv003-sp-itman01 ~]$ docker run -itd -p 8080:80 --shm-size=256m docker-kaldi-gstreamer-example:latest
Unable to find image 'docker-kaldi-gstreamer-example:latest' locally
docker: Error response from daemon: repository docker-kaldi-gstreamer-example not found: does not exist or no pull access.
See 'docker run --help'.

Expected token <IsGradient>, got </NaturalGradientAffineComponent>

I am using chain model from librispeech kaldi.
I am getting this error while running start.sh.

root@0ca580342230:/opt# cat worker.log
DEBUG 2018-06-12 06:35:24,111 Starting up worker
2018-06-12 06:35:24 - INFO: decoder2: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-vad': False, 'decoder': {'ivector-extraction-config': 'models/conf/ivector_extractor.conf', 'lattice-beam': 6.0, 'acoustic-scale': 1.0, 'do-endpointing': True, 'beam': 15.0, 'mfcc-config': 'models/conf/mfcc_hires.conf', 'traceback-period-in-secs': 0.25, 'nnet-mode': 3, 'endpoint-silence-phones': '1:2:3:4:5:6:7:8:9:10', 'word-syms': 'models/tdnn_sp/words.txt', 'num-nbest': 10, 'phone-syms': 'models/phones.txt', 'max-active': 7000, 'fst': 'models/tdnn_sp/HCLG.fst', 'use-threaded-decoder': True, 'model': 'models/tdnn_sp/final.mdl', 'chunk-length-in-secs': 0.25}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-nnet2': True}
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: nnet-mode = 3
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: ivector-extraction-config = models/conf/ivector_extractor.conf
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: lattice-beam = 6.0
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: acoustic-scale = 1.0
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: do-endpointing = True
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: beam = 15.0
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: mfcc-config = models/conf/mfcc_hires.conf
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: traceback-period-in-secs = 0.25
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: endpoint-silence-phones = 1:2:3:4:5:6:7:8:9:10
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: word-syms = models/tdnn_sp/words.txt
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: num-nbest = 10
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: phone-syms = models/phones.txt
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: max-active = 7000
2018-06-12 06:35:24 - INFO: decoder2: Setting decoder property: fst = models/tdnn_sp/HCLG.fst
2018-06-12 06:35:25 - INFO: decoder2: Setting decoder property: model = models/tdnn_sp/final.mdl
ERROR ([5.2.187~1-148c8]:Read():nnet-simple-component.cc:2463) Expected token , got

[ Stack-Trace: ]
kaldi::MessageLogger::HandleMessage(kaldi::LogMessageEnvelope const&, char const*)
kaldi::MessageLogger::~MessageLogger()
kaldi::nnet3::NaturalGradientAffineComponent::Read(std::istream&, bool)
kaldi::nnet3::Component::ReadNew(std::istream&, bool)
kaldi::nnet3::Nnet::Read(std::istream&, bool)
kaldi::nnet3::AmNnetSimple::Read(std::istream&, bool)

g_object_set_property

.
.
.
python() [0x4b988b]
PyEval_EvalFrameEx
PyEval_EvalFrameEx
PyEval_EvalCodeEx
python() [0x50160f]
PyRun_FileExFlags
PyRun_SimpleFileExFlags
Py_Main
__libc_start_main
python() [0x497b8b]

2018-06-12 06:35:25 - INFO: decoder2: Setting decoder property: chunk-length-in-secs = 0.25
2018-06-12 06:35:25 - INFO: decoder2: Created GStreamer elements
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstAppSrc object at 0x7fdda14e03c0 (GstAppSrc at 0x2ec05b0)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstDecodeBin object at 0x7fdda14e02d0 (GstDecodeBin at 0x2eb4080)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstAudioConvert object at 0x7fdda14e0280 (GstAudioConvert at 0x2ed3a60)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstAudioResample object at 0x7fdda14e0370 (GstAudioResample at 0x2d7c9f0)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstTee object at 0x7fdda14e0230 (GstTee at 0x2ee4000)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstQueue object at 0x7fdda14e0320 (GstQueue at 0x2ee8200)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstFileSink object at 0x7fdda14e0410 (GstFileSink at 0x2eec020)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstQueue object at 0x7fdda14e0460 (GstQueue at 0x2ee84f0)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.Gstkaldinnet2onlinedecoder object at 0x7fdda14e04b0 (Gstkaldinnet2onlinedecoder at 0x2f0e090)> to the pipeline
2018-06-12 06:35:25 - DEBUG: decoder2: Adding <main.GstFakeSink object at 0x7fdda14e0500 (GstFakeSink at 0x2decfc0)> to the pipeline
2018-06-12 06:35:25 - INFO: decoder2: Linking GStreamer elements
LOG ([5.2.1871-148c8]:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor
LOG ([5.2.187
1-148c8]:ComputeDerivedVars():ivector-extractor.cc:204) Done.
2018-06-12 06:35:25 - INFO: decoder2: Setting pipeline to READY
2018-06-12 06:35:25 - INFO: decoder2: Set pipeline to READY
2018-06-12 06:35:25 - INFO: main: Opening websocket connection to master server
2018-06-12 06:35:25 - INFO: main: Opened websocket connection to server

Yaml file:
use-nnet2: True
decoder:
use-threaded-decoder: True
model : models/tdnn_sp/final.mdl
word-syms : models/tdnn_sp/words.txt
fst : models/tdnn_sp/HCLG.fst
mfcc-config : models/conf/mfcc_hires.conf
ivector-extraction-config : models/conf/ivector_extractor.conf
phone-syms: models/phones.txt
nnet-mode: 3
max-active: 10000
beam: 15.0
lattice-beam: 6.0
acoustic-scale: 1
frame-subsamping-factor : 3
do-endpointing : true
endpoint-silence-phones : "1:2:3:4:5:6:7:8:9:10"
traceback-period-in-secs: 0.25
chunk-length-in-secs: 0.25
num-nbest: 10
#Additional functionality that you can play with:
#lm-fst: test/models/librispeech_nnet_a_online/G.fst
#big-lm-const-arpa: test/models/librispeech_nnet_a_online/G.carpa
#word-boundary-file: test/models/librispeech_nnet_a_online/word_boundary.int
#do-phone-alignment: true
out-dir: tmp

use-vad: False
silence-timeout: 10

post-processor: perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'

#full-post-processor: ./sample_full_post_processor.py

logging:
version : 1
disable_existing_loggers: False
formatters:
simpleFormater:
format: '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
formatter: simpleFormater
level: DEBUG
root:
level: DEBUG
handlers: [console]

Add more information on how to test the installation

I'm missing more detailed information in the README on how to verify that the installation was successful and the master and worker could be successfully started.

My worker.log looks good: there are no error messages and the last lines are:

2015-12-06 18:30:07 -    INFO:   __main__: Opening websocket connection to master server
2015-12-06 18:30:07 -    INFO:   __main__: Opened websocket connection to server

But testing with dictate.js and client.py does not produce any recognition results. E.g. I'm trying inside and outside the container:

python kaldi-gstreamer-server/kaldigstserver/client.py --uri ws://localhost:80/worker/ws/speech -r 8192 models/test/data/bill_gates-TED.mp3

python kaldigstserver/client.py --uri ws://localhost:8080/worker/ws/speech -r 8192 test/data/bill_gates-TED.mp3

but in both cases the server closes the socket and the client finishes without producing any output.

Trouble getting worker started

Hi -

Thanks so much @jcsilva for creating this! I've run into an issue getting a worker to start.

What I've already done:

  • Tried modified.yaml.txt (#3)
  • Increased Docker memory to 6GB

Other relevant information:


----> tail worker.log
  python(PyEval_EvalFrameEx+0xae2) [0x4ca592]
  python(PyEval_EvalCodeEx+0x411) [0x4c87a1]
  python() [0x5030ef]
  python(PyRun_FileExFlags+0x82) [0x4f8c72]
  python(PyRun_SimpleFileExFlags+0x197) [0x4f7d77]
  python(Py_Main+0x562) [0x4982f2]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc2473fab45]
  python() [0x497ca0]

----> tail master.log
  DEBUG 2016-10-14 21:48:39,496 Starting up server
  INFO 2016-10-14 21:50:55,365 New status listener
  INFO 2016-10-14 21:51:04,676 Status listener left
  WARNING 2016-10-14 21:51:09,412 404 GET /client/ws/statuss?encoding=text (172.17.0.1) 0.36ms

And when I connect to ws://localhost:8080/client/ws/status I get this:

RECEIVED: {"num_workers_available": 0, "num_requests_processed": 0}

And even though clearly no workers are started yet, for the sake of including everything I also get this response when I run client.py:

---> python client.py -u ws://localhost:8080/client/ws/speech -r 32000 /sample.flac
Received error from server (status 9)
Error message: No decoder available, try again later

Any suggestions on what to try?

AttributeError: 'NoneType' object has no attribute 'set_property'`

I am trying run the docker image and i have attached the model at models folder while docker run.
I get this error while running the worker.

root@0ca580342230:/opt# python ./kaldi-gstreamer-server/kaldigstserver/worker.py -u ws://localhost:8080/worker/ws/speech -c models/english.yaml DEBUG 2018-06-12 05:18:54,486 Starting up worker 2018-06-12 05:18:54 - INFO: decoder2: Creating decoder using conf: {'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'use-vad': False, 'decoder': {'ivector-extraction-config': 'models/english/conf/ivector_extractor.fixed.conf', 'lattice-beam': 6.0, 'acoustic-scale': 1.0, 'do-endpointing': True, 'beam': 15.0, 'frame-subsamping-factor': 3, 'traceback-period-in-secs': 0.25, 'nnet-mode': 3, 'endpoint-silence-phones': '1:2:3:4:5:6:7:8:9:10', 'word-syms': 'models/english/tdnn_sp/words.txt', 'num-nbest': 10, 'phone-syms': 'models/english/phones.txt', 'max-active': 7000, 'fst': 'models/english/tdnn_sp/HCLG.fst', 'use-threaded-decoder': True, 'model': 'models/english/tdnn_sp/final.mdl', 'chunk-length-in-secs': 0.25, 'mfcc-config': 'models/english/conf/mfcc_hires.conf'}, 'silence-timeout': 10, 'out-dir': 'tmp', 'use-nnet2': True} Traceback (most recent call last): File "./kaldi-gstreamer-server/kaldigstserver/worker.py", line 365, in <module> main() File "./kaldi-gstreamer-server/kaldigstserver/worker.py", line 345, in main decoder_pipeline = DecoderPipeline2(conf) File "/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py", line 24, in __init__ self.create_pipeline(conf) File "/opt/kaldi-gstreamer-server/kaldigstserver/decoder2.py", line 54, in create_pipeline self.asr.set_property("use-threaded-decoder", conf["decoder"]["use-threaded-decoder"]) AttributeError: 'NoneType' object has no attribute 'set_property'

Model yaml file :
use-nnet2: True
decoder:
use-threaded-decoder: True
model : models/english/tdnn_sp/final.mdl
word-syms : models/english/tdnn_sp/words.txt
fst : models/english/tdnn_sp/HCLG.fst
mfcc-config : models/english/conf/mfcc_hires.conf
ivector-extraction-config : models/english/conf/ivector_extractor.fixed.conf
phone-syms: models/english/phones.txt
nnet-mode: 3
max-active: 7000
beam: 15.0
lattice-beam: 6.0
acoustic-scale: 1.0
frame-subsamping-factor: 3
do-endpointing : true
endpoint-silence-phones : "1:2:3:4:5:6:7:8:9:10"
traceback-period-in-secs: 0.25
chunk-length-in-secs: 0.25
num-nbest: 10
#Additional functionality that you can play with:
#lm-fst: test/models/english/librispeech_nnet_a_online/G.fst
#big-lm-const-arpa: test/models/english/librispeech_nnet_a_online/G.carpa
#word-boundary-file: test/models/english/librispeech_nnet_a_online/word_boundary.int
#do-phone-alignment: true
out-dir: tmp

use-vad: False
silence-timeout: 10

post-processor: perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'

logging:
version : 1
disable_existing_loggers: False
formatters:
simpleFormater:
format: '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
formatter: simpleFormater
level: DEBUG
root:
level: DEBUG
handlers: [console]

Suggestion: Support multiple clients

I have a suggestion, I can't find any comparative project that supports Websockets, Real time ASR in a docker image. So Kudos to that!

I think this is a great project and could be an even awesome one. I would love to use it to provide my users ASR on a web app I have where other cloud solutions are cost prohibitive. So a drop in docker project like this is awesome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.