OpenVoiceOS / ovos-tts-plugin-piper

Apache License 2.0
17 stars 11 forks source link

Feat/init refactor #23

Open dblencowe opened 8 months ago

dblencowe commented 8 months ago

Tested on my Mk2 with the alba-medium voice Can be tested with

pip uninstall ovos-tts-plugin-piper && \
  pip install git+https://github.com/dblencowe/ovos-tts-plugin-piper@feat/init-refactor
sudo systemctl restart neon-audio
goldyfruit commented 8 months ago

Why all the changes in CHANGELOG.md?

dblencowe commented 8 months ago

Why all the changes in CHANGELOG.md?

Awful Git skills after having a mare with the Pipelines. Sorry!

goldyfruit commented 8 months ago

Why all the changes in CHANGELOG.md?

Awful Git skills after having a mare with the Pipelines. Sorry!

No worries :+1:

dblencowe commented 8 months ago

This works when downloading from a tz file but fails to load when pointed to an onyx file.

2024-01-25 06:52:24.805 - audio - ovos_tts_plugin_piper:download_model:335 - INFO - downloading piper model: https://huggingface.co/rhasspy/piper-voices/blob/v1.0.0/en/en_GB/vctk/medium/en_GB-vctk-medium.onnx
2024-01-25 06:52:25.661 - audio - ovos_plugin_manager.tts:create:215 - ERROR - The TTS plugin "ovos-tts-plugin-piper" could not be loaded.
Available modules: ovos-tts-plugin-piper,ovos-tts-plugin-dummy,ovos-tts-plugin-server,ovos-tts-plugin-mimic3-server,ovos-tts-plugin-mimic
Traceback (most recent call last):
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_plugin_manager/tts.py", line 206, in create
    tts = clazz(lang=None,  # explicitly read lang from config
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 267, in __init__
    self.get_model(voice=self.voice)
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 317, in get_model
    engine = self.load_model_directory(xdg_p)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 355, in load_model_directory
    config_dict = json.load(config_file)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/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)
2024-01-25 06:52:25.665 - audio - ovos_audio.service:__init__:93 - ERROR - Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/ovos/ovos-src/ovos-audio/ovos_audio/service.py", line 90, in __init__
    self._maybe_reload_tts()
  File "/home/ovos/ovos-src/ovos-audio/ovos_audio/service.py", line 318, in _maybe_reload_tts
    self.tts = TTSFactory.create(config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/ovos-src/ovos-audio/ovos_audio/tts.py", line 9, in create
    return OVOSTTSFactory.create(config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_plugin_manager/tts.py", line 206, in create
    tts = clazz(lang=None,  # explicitly read lang from config
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 267, in __init__
    self.get_model(voice=self.voice)
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 317, in get_model
    engine = self.load_model_directory(xdg_p)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ovos/venv-ovos/lib/python3.11/site-packages/ovos_tts_plugin_piper/__init__.py", line 355, in load_model_directory
    config_dict = json.load(config_file)
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/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)
2024-01-25 06:52:25.675 - audio - ovos_audio.service:on_error:44 - ERROR - Audio service failed to launch (Expecting value: line 1 column 1 (char 0)).

Tested with multiple voices

I'll look at this; I'm using alba-medium (lookup URL from the list) which has downloaded and deployed fine.

codecov[bot] commented 8 months ago

Welcome to Codecov :tada:

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered :open_umbrella: