Skip to content

Commit

Permalink
INSTALL: regroup & skip NLU generation when it was generated less tha…
Browse files Browse the repository at this point in the history
…n 1 day ago
  • Loading branch information
Commit-La-Grenouille committed Mar 25, 2022
1 parent 14637dc commit 817685d
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ if [ $upgrade -eq 1 -a $makerfaire2018 -eq 0 -a -d ${home_dir}/wm8960 ]; then
echo "Updating sound driver - 2/14" > /tmp/pynab.upgrade
cd ${home_dir}/wm8960
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" == "Already up to date." -o "$pull" == "Déjà à jour." ]; then
pull=$(LANGUAGE=en git pull)
if [ "$pull" == "Already up to date." ]; then
echo "Sound driver is already up-to-date..."
else
make && sudo make install && make clean
Expand All @@ -90,8 +90,8 @@ if [ $upgrade -eq 1 ]; then
if [ -d ${home_dir}/tagtagtag-ears ]; then
cd ${home_dir}/tagtagtag-ears
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" == "Already up to date." -o "$pull" == "Déjà à jour." ]; then
pull=$(LANGUAGE=en git pull)
if [ "$pull" == "Already up to date." ]; then
echo "Ears driver is already up-to-date..."
else
make && sudo make install && make clean
Expand All @@ -116,8 +116,8 @@ if [ $upgrade -eq 1 ]; then
if [ -d ${home_dir}/cr14 ]; then
cd ${home_dir}/cr14
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" == "Already up to date." -o "$pull" == "Déjà à jour." ]; then
pull=$(LANGUAGE=en git pull)
if [ "$pull" == "Already up to date." ]; then
echo "RFID driver is already up-to-date..."
else
make && sudo make install && make clean
Expand All @@ -142,8 +142,8 @@ if [ $upgrade -eq 1 ]; then
if [ -d ${root_dir}/nabblockly ]; then
cd ${root_dir}/nabblockly
sudo chown -R ${owner} .
pull=`git pull`
if [ "$pull" == "Already up to date." -o "$pull" == "Déjà à jour." ]; then
pull=$(LANGUAGE=en git pull)
if [ "$pull" == "Already up to date." ]; then
echo "NabBlockly is already up-to-date..."
else
./rebar3 release
Expand Down Expand Up @@ -238,14 +238,24 @@ if [ $makerfaire2018 -eq 0 ]; then
venv/bin/python -m snips_nlu generate-dataset fr */nlu/intent_fr.yaml > nabd/nlu/nlu_dataset_fr.json

echo "Persisting Snips engines"
if [ -d nabd/nlu/engine_en ]; then
rm -rf nabd/nlu/engine_en
fi
venv/bin/snips-nlu train nabd/nlu/nlu_dataset_en.json nabd/nlu/engine_en
if [ -d nabd/nlu/engine_fr ]; then
rm -rf nabd/nlu/engine_fr
fi
venv/bin/snips-nlu train nabd/nlu/nlu_dataset_fr.json nabd/nlu/engine_fr
#
# Regroupping the logic for all the languages supported
for LANG in "en" "fr"; do
ENGINE="nabd/nlu/engine_${LANG}"
if [ -d "${ENGINE}" ]; then
#
file_age=$(stat -c %Y "${ENGINE}")
epoch_now=$(date +"%s")
#
#Trying to save some time & CPU in case the dataset was generated already today
if (( (epoch_now - file_age) > (60 * 60 * 24) )); then
rm -rf "${ENGINE}"
venv/bin/snips-nlu train nabd/nlu/nlu_dataset_${LANG}.json ${ENGINE}
fi
else
venv/bin/snips-nlu train nabd/nlu/nlu_dataset_${LANG}.json ${ENGINE}
fi
done
fi

trust=`sudo grep local /etc/postgresql/*/main/pg_hba.conf | grep -cE '^local +all +all +trust' || echo -n ''`
Expand Down

0 comments on commit 817685d

Please sign in to comment.