Wake word not working with precise

I installed mycroft (18.08, rel 3) on my ubuntu 16.04 machine. All works great using pocket-sphynx and “hey mycroft” for the wake word. I thought the default was precise. Anyway, I asked mycroft to switch to precise and it complied. I waited long time for it to complete since there is no response saying when it is done. But now using precise it will not respond to the wake word. I have tried many things including restart, reboot, and reinstall. Using debug cli I confirmed it was using precise and the log shows it was loaded (see botom). There are no errors on loading. And using cli I can return to pocket-sphynx and it works again. Do you know how I can get it to use precise? I want to train my own wakeword and using pocket-sphynx had less than desired results.

More info. When I restart mycroft after changing to precise I do not see any lines in log about loading precise wakeword. I just get this:
18:31:37.511 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
18:31:37.513 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx
Perhaps precise is not being started.

Ron

17:37:57.941 - main:handle_utterance:61 - INFO - Utterance: [‘set my listener too precise’]
17:37:58.825 - mycroft.client.speech.listener:create_wake_word_recognizer:243 - INFO - creating wake word engine
17:37:58.826 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “hey mycroft” wake word via precise
17:38:00.723 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
17:38:00.725 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx
17:38:02.903 - mycroft.client.speech.listener:create_wake_word_recognizer:243 - INFO - creating wake word engine
17:38:02.904 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “hey mycroft” wake word via precise
17:38:03.807 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
17:38:03.809 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx

Hi there @Ron777,

Thanks for providing the log information.

I tried to replicate this on my Ubuntu 18.04 LTS system, and also found some anomalies. Firstly, I tried to see which listener was being used, and for some reason, PocketSphinx was being used, event though my Wake Word was the default Hey Mycroft. Using the phrase set my listener to Precise, Mycroft then tried to switch to Precise.

However, Mycroft kept trying to download Precise for over two hours with the message:

13:22:55.171 - mycroft.client.speech.hotword_factory:during_download:203 - INFO - Still downloading executable...
13:23:25.172 - mycroft.client.speech.hotword_factory:during_download:203 - INFO - Still downloading executable...
13:23:55.173 - mycroft.client.speech.hotword_factory:during_download:203 - INFO - Still downloading executable...
13:24:25.176 - mycroft.client.speech.hotword_factory:during_download:203 - INFO - Still downloading executable...

I checked the /var/log/mycroft/skills.log and /var/log/mycroft/audio.log but could not see any Precise-related errors.

Next, I then tried a manual install of Precise, which worked:

(.venv) kathyreid@kathyreid-Oryx-Pro:~/mycroft-core$ source venv-activate.sh 
Entering Mycroft virtual environment.  Run 'mycroft-venv-deactivate' to exit
(.venv) kathyreid@kathyreid-Oryx-Pro:~/mycroft-core$ pip3 install mycroft-precise
Collecting mycroft-precise
  Downloading https://files.pythonhosted.org/packages/1c/f0/b492a46ea66ca88cf64a4927ef2a0ef9dc6535d99b6dd83d6048c5ddc69f/mycroft_precise-0.2.0-py3-none-any.whl
[log truncated, it downloaded and installed all dependencies]

Then, I restarted Mycroft using ./start-mycroft.sh debug, and voila!, Precise Wake Word listener was working.

This left two questions:

  1. Your issue specifically is that Precise appears to be your default, but it is not activating
  2. Why wasn’t Precise installed correctly in the first place

Precise not triggering

At a guess, I think what is happening based on the log file is:

  • Precise is trying to activate but cannot
  • And Mycroft is falling back to PocketSphinx

This doesn’t explain though why the Wake Word is not triggering for you when set to Precise.

Conclusion: I don’t think Precise is installed properly. Can you please try a command line install as shown above?

Precise not being correctly installed

I looked at the /dev_setup.sh and requirements.txt in mycroft-core, and the only thing I can think of is if we need to add mycroft-precise into requirements.txt - as it is not installed directly in /dev_setup.sh. I’ll try a new build of mycroft-core and see if this works.

Thanks so much for your patience Ron as we work through this.

Best, Kathy

So I did a bit more digging on this, and;

  • Did a fresh install of mycroft-core on 18.8.3 on Ubuntu 18.04 LTS
  • But before running ./dev_setup.sh, I added mycroft-precise==0.20 to requirements.txt
  • Then ran /dev_setup.sh

It ran like a charm.

I’m going to flag this internally; I think we need to add mycroft-precise as a dependency.

I believe mycroft-precise is a dependency of precise-runner, so it should install by installing the runner.

So for the bughunt. Perhaps a quirck in precise-runner.

Agreed @j1nx, I think there is some quirk with precise-runner on Ubuntu, and possibly other *-bian flavoured systems. But the quirk is not showing up in the logs anywhere…

Thanks so much for helping. It is getting very frustrating. Most works but can not get precise to work. I did the manual install as you suggested and no difference. Precise is loading but it just goes to pocketsphinx and when I ask to go to precise it complies but then I get not response from hey mycroft.

I next tried this one and put “mycroft-precise==0.20” into requirements.txt as suggested. Got error when I ran dev_setup.sh. I noticed before that precise was ver 0.2.0 so I changed requirements.txt to that ver and the setup succeeded. However, the result did not change. I will not use precise and when forced it will not respond. Don’t give up on me. :slight_smile:
Ron

Just updated the stuff on the laptop to investigate.

13:53:42.725 - mycroft.client.speech.hotword_factory:on_download:191 - INFO - Downloading Precise executable...

13:53:47.728 - mycroft.client.speech.hotword_factory:during_download:203 - INFO - Still downloading executable…
13:53:48.407 - mycroft.client.speech.hotword_factory:initialize:281 - ERROR - Could not create hotword. Falling back to default.
Traceback (most recent call last):
File “/home/peter/mycroft-core/mycroft/client/speech/hotword_factory.py”, line 269, in initialize
instance = clazz(hotword, config, lang=lang)
File “/home/peter/mycroft-core/mycroft/client/speech/hotword_factory.py”, line 132, in init
precise_exe = self.install_exe(precise_config[‘dist_url’])
File “/home/peter/mycroft-core/mycroft/client/speech/hotword_factory.py”, line 164, in install_exe
on_download=self.on_download, on_complete=self.on_complete
File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/petact/petact.py”, line 121, in install_package
download_extract_tar(tar_url, folder, data_file)
File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/petact/petact.py”, line 83, in download_extract_tar
tar.extractall(path=folder)
File “/usr/lib/python3.6/tarfile.py”, line 2008, in extractall
numeric_owner=numeric_owner)
File “/usr/lib/python3.6/tarfile.py”, line 2050, in extract
numeric_owner=numeric_owner)
File “/usr/lib/python3.6/tarfile.py”, line 2120, in _extract_member
self.makefile(tarinfo, targetpath)
File “/usr/lib/python3.6/tarfile.py”, line 2169, in makefile
copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
File “/usr/lib/python3.6/tarfile.py”, line 249, in copyfileobj
buf = src.read(bufsize)
File “/usr/lib/python3.6/gzip.py”, line 276, in read
return self._buffer.read(size)
File “/usr/lib/python3.6/_compression.py”, line 68, in readinto
data = self.read(len(byte_view))
File “/usr/lib/python3.6/gzip.py”, line 482, in read
raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached

So it looks like the “precise-data” binary tar.gz is either corrupt or the download makes it corrupt.

Manually deleted precise-engine files, redownloaded by mycroft but clould not extract the package. Manually extracted the package, but still no luck.

These items appear in the logs

Exception in thread Thread-34:
Traceback (most recent call last):
 File “/usr/lib/python3.6/threading.py”, line 916, in _bootstrap_inner
   self.run()
 File “/usr/lib/python3.6/threading.py”, line 864, in run
   self._target(*self._args, **self._kwargs)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 197, in _handle_predictions
   prob = self.engine.get_prediction(chunk)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 65, in get_prediction
   return float(self.proc.stdout.readline())
ValueError: could not convert string to float:  

Exception in thread Thread-28:
Traceback (most recent call last):
 File “/usr/lib/python3.6/threading.py”, line 916, in _bootstrap_inner
   self.run()
 File “/usr/lib/python3.6/threading.py”, line 864, in run
   self._target(*self._args, **self._kwargs)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 197, in _handle_predictions
   prob = self.engine.get_prediction(chunk)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 64, in get_prediction
   self.proc.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

Exception in thread Thread-16:
Traceback (most recent call last):
 File “/usr/lib/python3.6/threading.py”, line 916, in _bootstrap_inner
   self.run()
 File “/usr/lib/python3.6/threading.py”, line 864, in run
   self._target(*self._args, **self._kwargs)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 197, in _handle_predictions
   prob = self.engine.get_prediction(chunk)
 File “/home/peter/mycroft-core/.venv/lib/python3.6/site-packages/precise_runner/runner.py”, line 64, in get_prediction
   self.proc.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

Ah, apologies for the typo, that was poor of me.

Well, we at least know that Precise is installed, but I don’t know why precise-runner did not install it properly. The issue is not just on your machine, I had the same issue here on Ubuntu 18.04 LTS so it’s more widespread. My log analysis didn’t show anything obvious I’m afraid.

But let’s turn our attention to why Precise is not activating properly for you. You’ve confirmed that you’re using the Default Wake Word of Hey Mycroft, so it’s unlikely to be a custom Wake Word setting issue (more information on setting a custom Wake Word here).

We’re definitely not going to give up on you :wink:

Are you comfortable telling me;

  • Do you have a strong accent at all (I grew up in Northumbria so totally understand Pitmatic, Geordie, and Mackem, not so good with the West Country ones :wink:
  • It may be that we don’t have enough samples of your particular accent for Mycroft to “recognise” your utterance of Hey Mycroft as the Wake Word. Are you opted in to our open dataset?

Best, Kathy

@KathyReid “precise-runner” downloads the proper “precise-data” binary, but fails to properly extract the archive. Because of that, it fails to finish the “set to precise” process. Configuration wise it however says the listener is set to precise however, because the process is not properly finished Mycroft ends up in sort sort of “in the middle state”.

My guess, however not confirmed yet is that Debian based systems updated some of the tar / gzip packages and therefor the python bindings to it have changed and are bugged at the moment.

Perhaps updating the python packages that are handling the tar / gzip process needs updating.

Or python itself got updated or something.

Great leads, thanks @j1nx - did this show up in a log file / terminal output somewhere? I’m guessing it was part of the mycroft-core install and I just missed it…

Those snippets are from the voice.log as precise is logged to that part of mycroft.

Yeah the trick is that precise-runner is failing to install precise-data, but this failure does not show up in voice.log. I think I need to closely watch a Linux install from scratch and see if I can see the failure, possibly pipe stdout to a file for later examination. Will report back.

I know you are further along in the problem but to answer your question, no I do not have an accent
and have no problem with other SR pkgs. Mycroft with pocketsphinx works just fine. Not so well on
a custom wake word which is why I would like to use precise.

Ron

So, the problem we’re trying to solve now that Precise is installed, is why it’s not recognising your voice when you say the Wake Word. Is it still falling back to PocketSphinx or is it trying to use Precise to hear the Wake Word and not recognising it?

Can you show me your current log output / screenshot of the CLI?

(Sorry to go over old ground, I just want to make sure we’re diagnosing from the right spot)

I thought the problem was determined to be that precise-runner is failing to install precise-data. In any case below is the log with my comments in '()'s. I have to be away from my office for a few days so I will not be able to provide more debug info directly but will be able to answer any questions and continue in the discussion.

Ron


what listener

The listener is pocket sphinx.
hey mycroft (audible invoke of “hey mycroft” works with pocketsphinx)
change listener too precise
Downloading the new listener, this will take a bit and you won’t
be able to use me until it completes. Give me a minute before
attempting to activate me again.

— Log Output
08:51:33.410 - main:handle_wakeword:56 - INFO - Wakeword Detected: hey mycroft
08:51:34.776 - main:handle_utterance:61 - INFO - Utterance: [‘change listener too precise’]
08:51:36.238 - mycroft.client.speech.listener:create_wake_word_recognizer:243 - INFO - creating wake word engine
08:51:36.239 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “hey mycroft” wake word via precise
08:51:38.246 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
08:51:38.247 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx
08:51:40.407 - mycroft.client.speech.listener:create_wake_word_recognizer:243 - INFO - creating wake word engine
08:51:40.408 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “hey mycroft” wake word via precise
08:51:41.476 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
08:51:41.478 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx
08:53:58.897 - mycroft.client.speech.listener:create_wake_word_recognizer:243 - INFO - creating wake word engine
08:53:58.898 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “hey mycroft” wake word via pocketsphinx
08:53:58.929 - mycroft.client.speech.listener:create_wakeup_recognizer:263 - INFO - creating stand up word engine
08:53:58.930 - mycroft.client.speech.hotword_factory:load_module:261 - INFO - Loading “wake up” wake word via pocketsphinx
— Log Output end

(wait 5 minutes)
what listener

The listener is set to precise.

(no response for “hey mycroft” wake phrase)
(When I type in “what listener” I get:)

The current listener is precise.

Thanks for that @Ron777, I also think you manually installed Precise if I recall.

I honestly don’t know what’s going on here, I’m going to ping my colleague @Wolfgange on this one to see if he has any ideas on the best way to diagnose this one.

At one point I did manually install precise but not sure if available to this vir env. I do not
work much with python or the vir env
stuff so not sure if it is using that one or other. Anyway, have you had luck with a fresh install
on a ubuntu 16 or 18 system yet? I am happy to uninstall things and do a fresh
install (not OS). But that will probably not happen till next Monday as I am away from my system this
week. But I am excited about using your stuff with my research work here at Bell Labs. And
I would like to work with you all to extend it possibly. Right now just skunk works. Thanks
again for your help, I am sure you are working a thousand issues at once.

Ron

I am back and still trying to get mycroft running on ubuntu 16.04 on x86_64. Just in case something changed (for the better) I reinstalled mycroft per instructions and ran it. Unfortunately now I can not even pair the device as it failed to connect to mycroft when I ran start-mycroft.sh debug . I am able to ping mycroft.ai so the computer can get to the host. I even tried on a different computer which I did not update and it could not get to mycroft.ai. I do not see anyone else having this problem. Any ideas? Thanks.

Ron