alumae / kaldi-gstreamer-server

Real-time full-duplex speech recognition server, based on the Kaldi toolkit and the GStreamer framwork.
BSD 2-Clause "Simplified" License
1.07k stars 342 forks source link

No final result, python error #181

Open charlesjankowski opened 5 years ago

charlesjankowski commented 5 years ago

I frequently get the error below which seems to be non-impacting, but I don't get a final result. I know it's done when I get an adaptation state.

Any ideas?

Thanks!

From /opt/worker.log:

2019-03-26 23:00:45 - INFO: decoder2: 76218ab3-2e7f-43ae-8c28-32c40b087d8e: Got partial result: AH LONELY WHAT'S THE WHETHER IN SAN FRANCISCO AUGUST 2019-03-26 23:00:45 - INFO: main: 76218ab3-2e7f-43ae-8c28-32c40b087d8e: Postprocessing (final=False) result.. 2019-03-26 23:00:45 - DEBUG: root: 76218ab3-2e7f-43ae-8c28-32c40b087d8e: Starting postprocessing: AH LONELY WHAT'S THE WHETHER IN SAN FRANCISCO AUGUST 2019-03-26 23:00:45 - ERROR: tornado.application: Future exception was never retrieved: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/opt/kaldi-gstreamer-server/kaldigstserver/worker.py", line 214, in _on_full_result full_result = yield self.post_process_full(full_result) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 260, in result raise_exc_info(self._exc_info) File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 315, in wrapper yielded = next(result) File "/opt/kaldi-gstreamer-server/kaldigstserver/worker.py", line 335, in post_process_full self.full_post_processor.stdin.write("%s\n\n" % json.dumps(full_result)) IOError: [Errno 32] Broken pipe 2019-03-26 23:00:45 - INFO: main: a133dca6-c4a3-4490-8799-5b8e3a993bbd: Sending adaptation state to client... 2019-03-26 23:00:45 - DEBUG: root: 76218ab3-2e7f-43ae-8c28-32c40b087d8e: Postprocessing returned: AH LONELY WHAT'S THE WHETHER IN SAN FRANCISCO AUGUST.

2019-03-26 23:00:45 - INFO: main: 76218ab3-2e7f-43ae-8c28-32c40b087d8e: Postprocessing done.

alx741 commented 5 years ago

I'm having the same issue, the worker seems to be dropping the EOS (even though it was sent) and keeps waiting for it.

The problem is likely to be in the worker and not in the client as I'm experiencing this behavior with a custom written/completely independent client.

As a work around I'm trying to keep sending EOS until I get a final hypothesis back from the worker.

Note: This issue is a duplication from #180

anmyeondo commented 3 years ago

subprocess.stdin.write's arguments should be byte type.

  1. you have to convert string to byte like self.full_post_processor.stdin.write("{0}\n\n".format(json.dumps(full_result)).encode())
  2. Use sys.stdin.buffer.readline() instead of sys.stdin.readline() in sample_full_post_processor.py to read into bytes and convert byte to string use Byte.decode()
  3. you decode self.full_post_processor.stdout.readline() (subprocess.stdout.readline() return byte type)

If the above doesn't work check your full-post-processor in yaml file and check your shell can execute ./sample_full_post_processor.py ( In my case, i use full-post-processor: python3 sample_full_post_processor.py in yaml file)