Home Assistant Voice PE - Custom Wake Words Please!

What about the ability in an add-on or integration that actually makes api calls to these cloud services or a docker container on the local network that can orchestrate all of this?

Most of these companies make up words like ā€˜Cortana’ specifically so that they can be trademarked to preserve ownership. I’ve gone through the process a couple of times as an owner (I’m not a lawyer).

Basically in the US, words/phrases are protected based on usage and uniqueness. You have to declare the industry where the ā€˜mark’ will be used. Then a judgement is issued by the US patent and trademark office awarding you the exclusive use of the trademark. If it’s unique in that industry you typically will get it. Generic words are hard to trademark but doable. Made up words and phrases are much easier. Then the burden is on the owner to enforce the mark via cease & desist orders or lawsuits. Disney is notorious for this. I heard a story that they once sued a kindergarten teacher for using The Mouse in their classroom.

What are the prerequisites to training a model? Is it Linux-only? Does it require CUDA? I wonder if that’s the barrier… so if we had a batch script or something that would:

  • Check for WSL2 or install/configure it
  • Check that an appropriate distro is installed for training or install/configure it
  • Check for CUDA or direct the user to download+install it
  • Automatically download the training file(s) and data to the Linux distro
  • Provide instructions on next steps

That’s just one idea/example, and again, I’m not sure how training works exactly, but I think that providing some sort of semi-automated process is the way to go. That’s why a lot of these other AI tools have succeeded - you don’t need to faff around with Python or CUDA or downloading models, you just run start.bat or start.sh and it does everything for you, and then starts the application.

The only training notebooks I’ve seen are CUDA, Jake and the one that used to be available required a card with >16gb vram.

Python 3.10+ is the main requirement with CUDA drivers and access to the GPU. I think it could run on Windows native, but on my local box I only I tried via WSL2 and docker on my windows box. Having looked it up a bit more, hardware should be:

  • GPU >12GB vram. Mine has 8GB which was likely my slowness and/or error issue.
  • ChatGPT says VRAM is more important than model generally speaking.

This method on my machine was slow and error prone. After hours of googling I found I had to go through the gpu paravirtualization steps above. Then I had to get the run settings right. Then it took hours to run. Then it would fail and I’d run it again.

I also tried running it in AWS. I figured if I could rent some serious metal for a few hours, it would go fast and wouldn’t be too expensive. Even at $20/hr, if I could spit out a model in 10min, no big deal. They have hardware like tensor tuned custom cards, and Tesla GPUs built for this kind of thing.

That was problematic for a few reasons. First I had to get manual approval for their higher end GPU stack. Then I installed a light Alpine+Docker AMI and used the microwakeword image and Jupyter. After many more hours of tuning and running and tuning, I found that it really didn’t generate models much faster. Maybe shaved 15 min. off a run compared to my PC. I don’t know if the image couldn’t utilize the full GPU but even exec-ing into it the GPU test passed.

I also tried using AWS SageMaker which I had a hard time getting running and then errored a lot before I gave up.

In the end after about 2 weeks of tinkering my bill was about $18. Not bad but it didn’t yeild anything. I was hoping it would be closer to $1-2 per wake word. Local PC was better but perhaps I don’t know enough about how to make AWS fully work for this.

The one I posted above is working on a laptop 3070 with 8gb vram, nothing needs to be adjusted except for the wake word you want to use

It doesn’t take long to train the longest part is setting up all the training data

This is the original repo btw just updated and moved to a different git account

There is a apple silicon trainer working also thanks to the recent piper sample generator update

ill update it to include wget and ffmpeg, thanks

That’s good the early trainers were setup for 24g… Kind of absurd for oww2 training.

we could start a collection here if you guys want for people who dont have the means to train

Might want to set an environment var for the ffmpeg@7 dynamic libs (or I think it also checks for 6, 5, and maybe 4?) unless that’ll be handled. The default ffmpeg (8 I guess) brew installed for me on this Tahoe mac didn’t contain the needed libs.

I’d hand edited the script, but @qJake provided what’s possibly a cleaner option:

</s> <s>DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/opt/ffmpeg@7/lib/ &&</s> <s>python scripts_macos/make_features.py</s> <s>

Nevermind…ignore me, I see you’ve already handled it ::slight_smile: :grinning:

Good idea. I forked this one but it hasn’t been active in a while GitHub - JohnnyPrimus/Custom_V2_MicroWakeWords

I’m not sure where to paste this. Is it the configuration.yaml file?

This is for ā€žtaking controlā€œ over your VPE’s config with the ESPHome addon. This config imports the default config and just overwrite the wakeword section.

I’m using a similar config for quite some time and the Alexa wakeword works pretty well. :slightly_smiling_face:

There is also this one for training the MWW with a Nvidia card. No 50XX support as of yet though.

Thank you, been looking for something like this. I’m not a tech professional, just a power user with some good hardware, but I’ll try to take a run at this over the weekend and report back.

Once I have the actual model, do you know where I can learn more about how to upload it to my HA Voice PE? This will be the first time I’ve messed with it much beyond simple daily use.

I was able to generate a model using the linked Jupyter notebook and an Ubuntu VM. Anyone know how to get it onto the HA Voice PE?

I believe, under ā€œmodelsā€ in ā€œmicro_wake_wordā€ section you provide an ID and point to a location accesible by the esphome device builder

micro_wake_word:
  id: mww
  microphone:
    microphone: i2s_mics
    channels: 1
    gain_factor: 4
  stop_after_detection: false
  models:
    - model: https://github.com/kahrendt/microWakeWord/releases/download/okay_nabu_20241226.3/okay_nabu.json
      id: okay_nabu
    - model: hey_jarvis
      id: hey_jarvis
    - model: alexa
      id: alexa      
    - model: hey_mycroft
      id: hey_mycroft
    - model: https://github.com/kahrendt/microWakeWord/releases/download/stop/stop.json
      id: stop
      internal: true

Is there a ā€œCassandraā€ or ā€œhey_cassandraā€ trained model available anywhere?

I wish. There’s an ā€œAlexaā€ mww, but I replaced in the script I shared so it wasn’t so obvious.

In any case, ā€œAlexaā€ is not as good as the default ones, and ā€œokey nabuā€ is too weird to my non-english family, so nobody uses voice preview right now.

Big respect @TaterTotterson — this custom microwakeword setup is pure magic !! Thanks a lot !!
PS. Where’s the ā€˜buy me a coffee’ link in your github ? :slight_smile: