esphome / wake-word-voice-assistants

Apache License 2.0
22 stars 13 forks source link

Build failing for M5Stamp Atom Echo with HAOS ESPHome Add-On #23

Closed TheWebMachine closed 3 weeks ago

TheWebMachine commented 4 weeks ago

When attempting to build for my new M5Stamp Atom Echo, I am encountering errors early in the build process here:

Generating assembly for .pioenvs/m5stack-atom-echo-9f64a0/duer_profile.S
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/api_connection.o
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/api_frame_helper.o
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/api_pb2.o
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/api_pb2_service.o
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/api_server.o
Compiling .pioenvs/m5stack-atom-echo-9f64a0/src/esphome/components/api/list_entities.o

Full log output herein: logs_m5stack-atom-echo-9f64a0_run.txt

I don't get this error building for my other ESPHome devices. Only for the Atom Echo. I am able to install the firmware via one of the web methods ($13 VA tutorial or the ReadyESP)...but I want to be able to customize the YAML so relying only on the Integration for management isn't gonna cut it for me.

TheWebMachine commented 3 weeks ago

I'm going to close this issue, but include a word of warning here in case anybody else comes looking.

TL;DR: You need more than 8GiB RAM to build the tensorflow components! Sorry PI users!

After multiple build attempts, even attempting to build in ESPHome beta, I noticed that the failure was occasionally happening at different points and occasionally resulting in segmentation fault. Given how rare this should happen, I started digging a little deeper.

I initially had 6 CPU cores and 8 gigs of RAM assigned to my home assistant virtual machine (x86 HAOS VM on modern AMD). It turns out the TensorFlow components require significantly more resources than this to build. I had already intended to increase resource allocation to Home Assistant because of the wake word processing in HA (custom WW), so I went ahead and powered down and increased the resources to 16 cores and 32 gigs of RAM. The build succeeded, and I noticed that total RAM usage ballooned up to over 6.5 gigs in the ESP-Home's build process. This explains my failures before. Even with all of these resources at its disposal, it still took over 20 minutes to build the firmware initially. This means well over an hour for me to build all six devices to adopt them.

So, in conclusion, anybody who wants to build this wake word assistant in ESPHome is going to need to do so on something with more than 8 gigs of RAM (Sorry Pi users!). This likely explains the various posts on Reddit and in forums discussing how people have had problems building this firmware and have had to use the ready-built bin files from the Home Assistant tutorial.

Hope this helps others! (Perhaps add a note to the readme for this repo mentioning the high resource needs to build?)