How to manually install Piper

Good to know that CPU’s are basically irrelevant :wink:

haha you can say that again. I just threw 100 CPU cores at it… it used %3000-%4000 CPU (30-40 cores) for a second or two, then settled aroung 800%… and still timed out, and then i saw in the container logs that i got an answer in 34 seconds ( 4 seconds after timeout)

Yeah. Maybe that beast wants quality rather than quantity. The CPU s I have are low-middle spec at best.

I’m reasonably sure that the container isn’t set up for GPU acceleration, but faster-whisper can use a GPU if it’s available. See the ctranslate2 docs: Installation — CTranslate2 3.13.0 documentation

I’m running my install on an old Mac Mini ATM; there is a CUDA replacement that works on Intel integrated GPUs but it’s only Skylake and later chips and mine’s too old. But if you’re running on a newer chip or have a real graphics card available in theory you should be able to offload whisper processing to the GPU.

Anyone have any luck installing these on Synology? I think I have Piper up and running, but Whisper keeps getting a core dump error.

/run.sh: line 5: 7 Illegal instruction (core dumped) python3 -m wyoming_faster_whisper --uri 'tcp://0.0.0.0:10300' --data-dir /data --download-dir /data "$@"

I’ve installed from the Docker Hub Rhasspy repo, mapped my port and volume data folder, and added the command: --model tiny-int8 --language en

The network is set in bridge mode. What am I doing wrong here?

Might be something else @guttermonk? I had no issues with basically the above docker-compose on a Synology DS920+.

I can get each of Whisper and Piper into HA via the Wyoming integration, but I haven’t had any luck from there yet. I’m getting a No text recognized (stt-no-text-recognized) error in the Assist Pipeline debug window. Not really sure how to debug from there as it could be a) the microphone (using an Atom Lite running Voice Assistant), b) the sound getting piped to whisper, c) whisper understanding it.

I get the same thing with both on a beefy PC, using a known working microphone.

Hi everyone, thanks for the examples and docker compose files :+1:

Do you know why the volumes are needed? Which data is stored and what is the downside if I don’t add a volume for it? So it will be deleted if I pull a new container?

I don’t want to store the data on the docker host. I could create a named volume for it, but I’m wonderingif it is even necessary.

i think you are right, the vol is there just so you dont need to re-download the data

1 Like

Thank you for the compose file. I know this isn’t HA related, but when I bring the containers up, they die after a few seconds because dns resolution fails. If I use docker run, they successfully download the files. After much googling, I tried adding a dns entry to my compose file, and even mapping my /etc/resolv.conf into the container, but no joy. I found a lot of questions referencing this, but not many answers.

That doesn’t make any sense to me.
Docker compose is the same as docker run, just based on a configuration file rather than setting the parameters on the command line.

Are you sure it’s a dns issue, and not a “file not found”?
Show the actual errors, please.

I had something similar happening. Are you using Adguard?

2023-06-04T13:40:20.177860612Z WARNING:wyoming_faster_whisper.download:Model hashes do not match
2023-06-04T13:40:20.177982277Z WARNING:wyoming_faster_whisper.download:Expected: {'config.json': 'e5a2f85afc17f73960204cad2b002633', 'model.bin': 'ecd0fd5e2eb9390a2b31b7dd8d871bd1', 'vocabulary.txt': 'c1120a13c94a8cbb132489655cdd1854'}
2023-06-04T13:40:20.177991675Z WARNING:wyoming_faster_whisper.download:Got: {'model.bin': '', 'config.json': '', 'vocabulary.txt': ''}
2023-06-04T13:40:20.177996951Z INFO:__main__:Downloading FasterWhisperModel.BASE_INT8 to /data
2023-06-04T13:40:30.192051696Z Traceback (most recent call last):
2023-06-04T13:40:30.192111478Z   File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open
2023-06-04T13:40:30.192807388Z     h.request(req.get_method(), req.selector, req.data, headers,
2023-06-04T13:40:30.192830854Z   File "/usr/lib/python3.9/http/client.py", line 1255, in request
2023-06-04T13:40:30.193292984Z     self._send_request(method, url, body, headers, encode_chunked)
2023-06-04T13:40:30.193308915Z   File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request
2023-06-04T13:40:30.194060658Z     self.endheaders(body, encode_chunked=encode_chunked)
2023-06-04T13:40:30.194084034Z   File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
2023-06-04T13:40:30.194477126Z     self._send_output(message_body, encode_chunked=encode_chunked)
2023-06-04T13:40:30.194499898Z   File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
2023-06-04T13:40:30.194937016Z     self.send(msg)
2023-06-04T13:40:30.194959510Z   File "/usr/lib/python3.9/http/client.py", line 950, in send
2023-06-04T13:40:30.195377574Z     self.connect()
2023-06-04T13:40:30.195400020Z   File "/usr/lib/python3.9/http/client.py", line 1417, in connect
2023-06-04T13:40:30.195958570Z     super().connect()
2023-06-04T13:40:30.195981186Z   File "/usr/lib/python3.9/http/client.py", line 921, in connect

But like I said, it runs and downloads the model just fine using docker run

No I am not. I do use Pi-hole, but I bypassed it and even tried other dns servers before I realized it only happened under compose.

Ah weird. I ran into an issue with compose where it was making too many requests simultaneously, so Adblock started blocking.

I increased the quote and am without issues.

This WIP PR wyoming-piper: init at 0.0.3, wyoming-faster-whisper: ini at 0.0.3 by mweinelt · Pull Request #236875 · NixOS/nixpkgs · GitHub will allow you to install whisper and piper with native home-assistant.

To be noted that it’s for NixOS which is, as far as I understand, is yet-another-package-manager.
Don’t expect much support, even from goodwill :wink:

@koying very true. But if you’re at the point where you need this badly, you can lookup what NixOS is doing and inspire yourself from that :stuck_out_tongue:

Edit: Piper image was rolled back to previous version, and is working again.

Anyone got issues with Piper and the latest image? It was working before I updated today.

Whisper continues to work, but HA is unable to connect to the Piper container.

Logger: aiohttp.server
Source: components/wyoming/data.py:69
First occurred: 09:53:06 (4 occurrences)
Last logged: 09:54:52

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 297, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/config_flow.py", line 41, in async_step_user
    service = await WyomingService.create(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 37, in create
    info = await load_wyoming_info(host, port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 69, in load_wyoming_info
    wyoming_info = Info.from_event(event)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in from_event
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in <listcomp>
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/util/dataclasses_json.py", line 17, in from_dict
    field = cls_fields[key]
            ~~~~~~~~~~^^^^^
KeyError: 'description'

And

Logger: homeassistant.config_entries
Source: components/wyoming/data.py:69
First occurred: 09:51:42 (2 occurrences)
Last logged: 09:51:42

Error setting up entry piper-en for wyoming
Error setting up entry piper-da for wyoming
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/__init__.py", line 18, in async_setup_entry
    service = await WyomingService.create(entry.data["host"], entry.data["port"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 37, in create
    info = await load_wyoming_info(host, port)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wyoming/data.py", line 69, in load_wyoming_info
    wyoming_info = Info.from_event(event)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in from_event
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/info.py", line 95, in <listcomp>
    tts=[TtsProgram.from_dict(d) for d in event.data.get("tts", [])],
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyoming/util/dataclasses_json.py", line 17, in from_dict
    field = cls_fields[key]
            ~~~~~~~~~~^^^^^
KeyError: 'description'

I cannot install Piper (via the Wyoming protocol) and this may be the reason why. I had it working ages ago as a test and then stopped it until I had time to play (i.e. now). What is the tag for the last working version?