Merge pull request #2910 from MycroftAI/feature/avx-check

Check for the AVX instruction set during install
pull/2913/head
Kris Gesling 2021-06-02 06:54:08 +09:30 committed by GitHub
commit 0e2a78068a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View File

@ -174,6 +174,32 @@ This script is designed to make working with Mycroft easy. During this
first run of dev_setup we will ask you a few questions to help setup
your environment.'
sleep 0.5
# The AVX instruction set is an x86 construct
# ARM has a range of equivalents, unsure which are (un)supported by TF.
if ! grep -q avx /proc/cpuinfo && [[ ! $(uname -m) == 'arm'* ]]; then
echo "
The Precise Wake Word Engine requires the AVX instruction set, which is
not supported on your CPU. Do you want to fall back to the PocketSphinx
engine? Advanced users can build the precise engine with an older
version of TensorFlow (v1.13) if desired and change use_precise to true
in mycroft.conf.
Y)es, I want to use the PocketSphinx engine or my own.
N)o, stop the installation."
if get_YN ; then
if [[ ! -f /etc/mycroft/mycroft.conf ]]; then
$SUDO mkdir -p /etc/mycroft
$SUDO touch /etc/mycroft/mycroft.conf
$SUDO bash -c 'echo "{ \"use_precise\": true }" > /etc/mycroft/mycroft.conf'
else
$SUDO bash -c 'jq ". + { \"use_precise\": true }" /etc/mycroft/mycroft.conf > tmp.mycroft.conf'
$SUDO mv -f tmp.mycroft.conf /etc/mycroft/mycroft.conf
fi
else
echo -e "$HIGHLIGHT N - quit the installation $RESET"
exit 1
fi
echo
fi
echo "
Do you want to run on 'master' or against a dev branch? Unless you are
a developer modifying mycroft-core itself, you should run on the

View File

@ -47,6 +47,10 @@ class NoModelAvailable(Exception):
pass
class PreciseUnavailable(Exception):
pass
def msec_to_sec(msecs):
"""Convert milliseconds to seconds.
@ -190,6 +194,8 @@ class PreciseHotword(HotWordEngine):
PreciseRunner, PreciseEngine, ReadWriteStream
)
local_conf = LocalConf(USER_CONFIG)
if not local_conf.get('precise', {}).get('use_precise', True):
raise PreciseUnavailable
if (local_conf.get('precise', {}).get('dist_url') ==
'http://bootstrap.mycroft.ai/artifacts/static/daily/'):
del local_conf['precise']['dist_url']
@ -487,6 +493,10 @@ class HotWordFactory:
hotword, module
))
instance = None
except PreciseUnavailable:
LOG.warning('Settings prevent Precise Engine use, '
'falling back to default.')
instance = None
except Exception:
LOG.exception(
'Could not create hotword. Falling back to default.')

View File

@ -199,6 +199,7 @@
// Settings used for any precise wake words
"precise": {
"use_precise": true,
"dist_url": "https://github.com/MycroftAI/precise-data/raw/dist/{arch}/latest",
"model_url": "https://raw.githubusercontent.com/MycroftAI/precise-data/models/{wake_word}.tar.gz"
},