Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar loading/unloading breaks during waking/sleeping with newer dragonfly versions #943

Open
codebold opened this issue Jan 11, 2024 · 2 comments
Assignees
Labels
Bug Unexpected behavior from existing features. Dragonfly A catchall label for issues related to Dragonfly Kaldi Related to Kaldi speech recognition backend

Comments

@codebold
Copy link

I'm using a customized version of dragonfly, as i need some adoptions for the neo2 keyboard layout. The requirement for dragonfly in caster is dragonfly2>=0.29.0. After switching to the latest version, the sleeping/waking functionality is broken. Whenever i put caster into sleep, the following error emerges and the process is killed.

engine (INFO): Loading grammar _recobs_grammar
Caster: Microphone is sleeping
Exception in thread Thread-1 (_reader_thread):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/dragonfly/dragonfly/engines/backend_kaldi/audio.py", line 110, in _reader_thread
    in_data, overflowed = self.stream.read(self.stream.blocksize)
  File "/.venv/lib/python3.10/site-packages/sounddevice.py", line 1196, in read
    _check(err)
  File "/.venv/lib/python3.10/site-packages/sounddevice.py", line 2653, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Stream is stopped [PaErrorCode -9983]
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/dragonfly/dragonfly/__main__.py", line 509, in <module>
    main()
  File "/dragonfly/dragonfly/__main__.py", line 504, in main
    return_code = func(args)
  File "/dragonfly/dragonfly/__main__.py", line 246, in cli_cmd_load
    _do_recognition(engine, args)
  File "/dragonfly/dragonfly/__main__.py", line 156, in _do_recognition
    engine.do_recognition()
  File "/dragonfly/dragonfly/engines/base/engine.py", line 251, in do_recognition
    self._do_recognition(*args, **kwargs)
  File "/dragonfly/dragonfly/engines/backend_kaldi/engine.py", line 434, in _do_recognition
    self.prepare_for_recognition()  # Do any of this leftover, now that phrase is done
  File "/dragonfly/dragonfly/engines/backend_kaldi/engine.py", line 332, in prepare_for_recognition
    operation()
  File "/dragonfly/dragonfly/engines/backend_kaldi/engine.py", line 246, in load
    kaldi_rule.load(lazy=self._compiler.lazy_compilation)
  File "/.venv/lib/python3.10/site-packages/kaldi_active_grammar/compiler.py", line 152, in load
    if self.destroyed: raise KaldiError("Cannot use a KaldiRule after calling destroy()")
kaldi_active_grammar.KaldiError: Cannot use a KaldiRule after calling destroy()

I know that this error might be caused by changes to dragonfly or kaldi_active_grammar, but i'm not familiar with the code base and maybe you encountered this error already or know at first glance what is wrong here.

Thanks for looking into this!

@codebold codebold added the Bug Unexpected behavior from existing features. label Jan 11, 2024
@codebold
Copy link
Author

Downgrading to dragonfly 0.35.0 resolved the issue for me. For me the error emerges with all versions >= 1.0.0-rc1 of dragonfly.

@LexiconCode LexiconCode self-assigned this Jan 13, 2024
@LexiconCode
Copy link
Member

LexiconCode commented Jan 13, 2024

Thank you for reporting this! I'm able to reproduce the issue.

@LexiconCode LexiconCode added Dragonfly A catchall label for issues related to Dragonfly Kaldi Related to Kaldi speech recognition backend labels Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected behavior from existing features. Dragonfly A catchall label for issues related to Dragonfly Kaldi Related to Kaldi speech recognition backend
Projects
None yet
Development

No branches or pull requests

2 participants