alphacep / vosk-server

WebSocket, gRPC and WebRTC speech recognition server based on Vosk and Kaldi libraries
Apache License 2.0
918 stars 248 forks source link

mqtt asr_server_mqtt crashes when running test_mqtt #139

Closed Talwar85 closed 3 years ago

Talwar85 commented 3 years ago

Hello, I tried to use the examples in the mqtt-folder, but when I started test_mqtt.py the server crashed with an invalid json error. I followed the example step by step.

msg.payload has an value but "if self.recognizer.AcceptWaveform(msg.payload):" does not seem to trigger in the script.

nshmyrev commented 3 years ago

What is the stacktrace?

Talwar85 commented 3 years ago

On Start: pi@rpiserver1:~/vosk-server/mqtt $ python3 asr_server_mqtt.py LOG (VoskAPI:ReadDataFiles():model.cc:211) Decoding params beam=13 max-active=7000 lattice-beam=6 LOG (VoskAPI:ReadDataFiles():model.cc:214) Silence phones 1:2:3:4:5:6:7:8:9:10 LOG (VoskAPI:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes. LOG (VoskAPI:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components. LOG (VoskAPI:Collapse():nnet-utils.cc:1488) Added 1 components, removed 2 LOG (VoskAPI:CompileLooped():nnet-compile-looped.cc:345) Spent 0.13252 seconds in looped compilation. LOG (VoskAPI:ReadDataFiles():model.cc:238) Loading i-vector extractor from model-ru/ivector/final.ie LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:204) Done. LOG (VoskAPI:ReadDataFiles():model.cc:271) Loading HCL and G from model-ru/HCLr.fst model-ru/Gr.fst LOG (VoskAPI:ReadDataFiles():model.cc:292) Loading winfo model-ru/word_boundary.int Connected to mqtt server

After starting python3 test_mqtt.py Traceback (most recent call last): File "asr_server_mqtt.py", line 75, in <module> server.run() File "asr_server_mqtt.py", line 26, in run self.client.loop_forever() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1779, in loop_forever rc = self.loop(timeout, max_packets) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1181, in loop rc = self.loop_read(max_packets) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1572, in loop_read rc = self._packet_read() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2310, in _packet_read rc = self._packet_handle() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle return self._handle_publish() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish self._handle_on_message(message) File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message self.on_message(self, self._userdata, message) File "asr_server_mqtt.py", line 50, in __on_mqtt_message data = json.loads(transcribe) File "/usr/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

nshmyrev commented 3 years ago

This should be fixed now