synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
944 stars 101 forks source link

Support for ARMv6 #61

Closed DanSkipper closed 4 years ago

DanSkipper commented 4 years ago

Rhasspy doesn't support ARMv6 which prevents its use on the Pi Zero and Pi Zero W. Either need new precompiled binaries for the v6 arch or a build from src option.

geotom commented 4 years ago

Also would love to see support for PiZeroes as they are a cheap way to build multi-side assistants.

Toxminn commented 4 years ago

I think a lot of people will be happy about that.

synesthesiam commented 4 years ago

I've ordered a Pi Zero so I can work on this :)

synesthesiam commented 4 years ago

I've successfully tested Rhasspy on a Pi Zero with a PS3 eye microphone. Currently compiling the rest of the tools, and will have it ready with the next version.

synesthesiam commented 4 years ago

Anyone familiar with GCC flags for armv6l? I get "Illegal instruction" errors out of binaries compiled natively on the Pi Zero! I suspect a ./configure script is failing to set the right GCC arguments to not use armv7l.

ghost commented 4 years ago

Hello there! I am not familiar with it but I found this issue on NodeJS that might be useful.

ChrisWeiss commented 4 years ago

I'm trying to compile rhasspy myself on a pair of Pi Zeros and Master is failing on both. Are you doing tweaks in a different branch?


libtool: link: g++ -I/home/pi/rhasspy/.venv/include -std=c++11 -o .libs/ngramcontext ngramcontext_main.o  -L/usr/local/lib/fst -lfstfar -lfst -lm -ldl -L/home/pi/rhasspy/.venv/lib ../lib/.libs/libngram.so -Wl,-rpath -Wl,/home/pi/rhasspy/build_armv6l/opengrm-ngram-1.3.4/build/lib
/bin/bash ../../libtool  --tag=CXX   --mode=link g++  -I/home/pi/rhasspy/.venv/include -std=c++11 -L/usr/local/lib/fst -lfstfar -lfst -lm -ldl -L/home/pi/rhasspy/.venv/lib -o ngramcount ngramcount_main.o ../lib/libngram.la ../lib/libngramhist.la
libtool: link: g++ -I/home/pi/rhasspy/.venv/include -std=c++11 -o .libs/ngramcount ngramcount_main.o  -L/usr/local/lib/fst -lfstfar -lfst -lm -ldl -L/home/pi/rhasspy/.venv/lib ../lib/.libs/libngram.so ../lib/.libs/libngramhist.so -Wl,-rpath -Wl,/home/pi/rhasspy/build_armv6l/opengrm-ngram-1.3.4/build/lib
/usr/bin/ld: warning: libfstscript.so.13, needed by ../lib/.libs/libngramhist.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: ../lib/.libs/libngramhist.so: undefined reference to `fst::script::WeightClass::NoWeight(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: ../lib/.libs/libngramhist.so: undefined reference to `fst::PrintFstInfoImpl(fst::FstInfo const&, bool)'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:482: ngramcount] Error 1```
ghost commented 4 years ago

Any updates on this? I would really love to have some rhasspy satellites as soon as possible

synesthesiam commented 4 years ago

@ChrisWeiss Building from source should be much easier soon. I'm eliminating the dependency on opengrm going forward.

@josopu Which services are you planning to run on your satellites? They may already be functional.

ghost commented 4 years ago

Just saw it in the docs! Was waiting for the new release to check it. Thanks for your advice 😄

kaykoch commented 4 years ago

271-# ----------------------------------------------------------------------------- 272-# Snowboy 273-# ----------------------------------------------------------------------------- 274- 275-case "${CPU_ARCH}" in 276- x86_64|armv7larmv6l)


I use snowboy/jarvis.umdl with 0.6,0.6 Every client got a sitId (Enable MQTT in Settings, write siteID, Disable MQTT)


Controlled with nodered and WebSocket In-Node. SiteID is stored to global variable (global.siteId) At end of nodred, answer ist send to clients with WebSocket out (one Websocket out for each client, output depends on global.siteId

Everything is perfekt. Same performance as snips. I will explain nodered configuration later in: https://community.rhasspy.org/c/show-us/

ghost commented 4 years ago

When I try to install using normal venv installation method this error appears:

curl: (22) The requested URL returned error: 404 Not Found Can't download https://github.com/synesthesiam/kaldi-docker/releases/download/v1.0/kaldi_armv6l.tar.gz

I just did disable the install kaldi flag on the download-dependencies but I don't know if this is a valid workaround

Furthermore, when I restart rhasspy after saving changes in the webUI this error appears:

./run-venv.sh: line 28: 599 Segmentation fault python3 app.py "$@"

DanSkipper commented 4 years ago

A couple of nights ago I installed Rhasspy successfully on my Pi Zero W.

Disabling Kaldi is necessary as is changing the networkx package as @kaykoch mentions.

Right now I can access the web front end and if I manually wake it then it will convert speech to intents. I'm struggling with:

Those are all probably because I don't know the system and need to do a bunch of learning but the installation on the Pi Zero works!

synesthesiam commented 4 years ago

@koenvervloesem and @maxbachmann are doing some great work getting Rhasspy to build in a Github Actions environment, and armv6l is among the supported platforms.

We'll be doing more extensive automated testing soon, which will hopefully identify the source of the bugs you're seeing. Stay tuned! :)

DanSkipper commented 4 years ago

How're you getting on with this and is there anything I can do to help?

synesthesiam commented 4 years ago

For the upcoming 2.5 release of Rhasspy, I have a Docker image for the Pi Zero now. It supports everything except Kaldi :)

So the only help I still need is figuring out how to have Kaldi detect the right CPU architecture on a Pi Zero (it erroneously detects armhf and thinks that's arm32v7 I guess).

ChrisWeiss commented 4 years ago

I don't have my Zero plugged in to check if this actually works (the Zero isn't explicitly called out), but the FAQ says you can check /proc/device-tree/model to get the correct SoC info.

Why does cpuinfo report I have a BCM2835? The upstream Linux kernel developers had decided that all models of Raspberry Pi return bcm2835 as the SoC name. At Raspberry Pi we like to use as much upstream kernel code as possible, as it makes software maintenance much easier, so we use this code. Unfortunately it means that cat /proc/cpuinfo is inaccurate for the Raspberry Pi 2, Raspberry Pi 3 and Raspberry Pi 4, which use the bcm2836/bcm2837, bcm2837 and bcm2711 respectively. You can use cat /proc/device-tree/model to get an accurate description of the SoC on your Raspberry Pi model.

synesthesiam commented 4 years ago

Thank you, @ChrisWeiss , but how do we make Kaldi use the correct gcc options? I don't have much experience getting C++ projects to build across multiple CPU architectures. I managed to modify one of the .mk files for Kaldi in order to get it build on aarch64, but arm32v6 seems harder to figure out.

nshmyrev commented 4 years ago

but how do we make Kaldi use the correct gcc options

You just take a armv6 toolchain and change the host triple to armv6-linux-gnu or something:

&& sed -i "s:TARGET_ARCH=\"\`uname -m\`\":TARGET_ARCH=$(echo $CROSS_TRIPLE|cut -d - -f 1):g" configure \
    && ./configure --mathlib=OPENBLAS --shared --use-cuda=no \
    && make -j 10 online2 \

You can check for more details https://github.com/alphacep/vosk-api/blob/master/travis/Dockerfile.dockcross

synesthesiam commented 4 years ago

armv6 support in 2.5 is coming through the rhasspy-satellite project.