rhasspy / hassio-addons

Add-ons for Home Assistant's Hass.IO
MIT License
63 stars 30 forks source link

Advice to run vosk without hassio-addons #52

Closed sebPomme closed 11 months ago

sebPomme commented 11 months ago

Hi, I didn't have hassio-addons and I want to run vosk.

I try this:
my docker-compose.yml file

services:
  engine:
    restart: always
    image: rhasspy/wyoming-vosk:1.3.1
    build:
      context: https://github.com/rhasspy/hassio-addons.git#:vosk
      args:
        BUILD_FROM: ghcr.io/home-assistant/aarch64-base-debian:bookworm
        WYOMING_VOSK_VERSION: 1.3.1
    ports:
      - 10300:10300
    volumes:
      - /srv/docker_data/vosk:/data

I put this configuration file in /srv/docker_data/vosk/options.json

{ 
  "debug_logging": "true",
  "correct_sentences": "0.0",
  "preload_language": "fr"
}

It's build. Then fail with on the run with

pomme@box# docker compose up
[+] Running 1/1
 ✔ Container wyoming-vosk-engine-1  Recreated                                                                                                                                             1.1s 
Attaching to wyoming-vosk-engine-1
wyoming-vosk-engine-1  | s6-rc: info: service s6rc-oneshot-runner: starting
wyoming-vosk-engine-1  | s6-rc: info: service s6rc-oneshot-runner successfully started
wyoming-vosk-engine-1  | s6-rc: info: service fix-attrs: starting
wyoming-vosk-engine-1  | s6-rc: info: service fix-attrs successfully started
wyoming-vosk-engine-1  | s6-rc: info: service legacy-cont-init: starting
wyoming-vosk-engine-1  | s6-rc: info: service legacy-cont-init successfully started
wyoming-vosk-engine-1  | s6-rc: info: service vosk: starting
wyoming-vosk-engine-1  | s6-rc: info: service vosk successfully started
wyoming-vosk-engine-1  | s6-rc: info: service discovery: starting
wyoming-vosk-engine-1  | curl: (6) Could not resolve host: supervisor
wyoming-vosk-engine-1  | [23:58:54] ERROR: Something went wrong contacting the API
wyoming-vosk-engine-1  | usage: __main__.py [-h] [--uri URI] --data-dir DATA_DIR
wyoming-vosk-engine-1  |                    [--download-dir DOWNLOAD_DIR] [--language LANGUAGE]
wyoming-vosk-engine-1  |                    [--preload-language PRELOAD_LANGUAGE]
wyoming-vosk-engine-1  |                    [--model-for-language language model]
wyoming-vosk-engine-1  |                    [--casing-for-language language casing]
wyoming-vosk-engine-1  |                    [--model-index MODEL_INDEX] [--sentences-dir SENTENCES_DIR]
wyoming-vosk-engine-1  |                    [--database-dir DATABASE_DIR]
wyoming-vosk-engine-1  |                    [--correct-sentences [CORRECT_SENTENCES]]
wyoming-vosk-engine-1  |                    [--limit-sentences] [--allow-unknown] [--debug]
wyoming-vosk-engine-1  | __main__.py: error: argument --correct-sentences: invalid float value: 'null'
wyoming-vosk-engine-1  | [23:58:56] INFO: Service exited with code 2 (by signal 0)

It's looks like this line fail but I can't find why.

Maybe I miss something obvious for a pro adddons user ? Mayby I have to put options.json somewhere else ?

Any help will be appreciated

pomme :apple:

synesthesiam commented 11 months ago

The add-on uses bashio to parse the config, etc. You should just be able to run the wyoming-vosk image by itself with --uri 'tcp://0.0.0.0:10300' and--data-dir

arguments (where` is externally mapped so models can be downloaded).

sebPomme commented 11 months ago

Thanks for taking time to answer me.

I just figured out where are my mistakes

Anyway I think you are talking about this image. Tried to use it and get

root@rpi-githuber:/opt/etc/docker-compose/wyoming-vosk# docker run -v /srv/docker_data/vosk:/data -p 10300:10300 rhasspy/wyoming-vosk:1.3.1 --data-dir=/data --download-dir=/data --data-dir=/share/vosk/models --sentences-dir=/share/vosk/sentences --correct-sentences=0 --language=fr --preload-language=fr --debug
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/lib/python3.11/dist-packages/wyoming_vosk/__main__.py", line 13, in <module>
    from vosk import KaldiRecognizer, Model, SetLogLevel
  File "/usr/local/lib/python3.11/dist-packages/vosk/__init__.py", line 36, in <module>
    _c = open_dll()
         ^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/vosk/__init__.py", line 30, in open_dll
    return _ffi.dlopen(os.path.join(dlldir, "libvosk.so"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: cannot load library '/usr/local/lib/python3.11/dist-packages/vosk/libvosk.so': libatomic.so.1: cannot open shared object file: No such file or directory

I patch it, and it works fine now. I have one question left: did you know where can I find the dockerfile for https://hub.docker.com/r/rhasspy/wyoming-vosk to make a contribution to install libatomic ?