This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| projects:iotaiuto:mycroft [2021/11/08 10:13] – created daniel | projects:iotaiuto:mycroft [2021/12/15 13:10] (current) – daniel | ||
|---|---|---|---|
| Line 34: | Line 34: | ||
| * Al termine dell' | * Al termine dell' | ||
| - | **Aggiornamento della configurazione** | + | **Aggiornamento della configurazione**\\ |
| Dal terminale del raspberry: | Dal terminale del raspberry: | ||
| < | < | ||
| Line 46: | Line 46: | ||
| cd mycroft-core | cd mycroft-core | ||
| pip install --upgrade . | pip install --upgrade . | ||
| + | </ | ||
| + | |||
| + | **Impostare lingua italiana** | ||
| + | < | ||
| + | nano .config/ | ||
| + | </ | ||
| + | Aggiungere: | ||
| + | < | ||
| + | { | ||
| + | ... | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| + | // TODO aggiungere " | ||
| + | } | ||
| </ | </ | ||
| ==== Installazione della scheda audio ==== | ==== Installazione della scheda audio ==== | ||
| - | Modello della scheda: | + | Scheda audio modello ReSpeaker 2 Mics Pi HAT (seeedstudio |
| - | https:// | + | |
| - | https:// | + | |
| * Inserire la scheda respeaker 2-mic nella socket del raspberry | * Inserire la scheda respeaker 2-mic nella socket del raspberry | ||
| Line 84: | Line 99: | ||
| </ | </ | ||
| * Chiudere e salvare | * Chiudere e salvare | ||
| - | * Riavviare e testare: | ||
| < | < | ||
| sudo reboot | sudo reboot | ||
| + | </ | ||
| + | ==== Test scheda audio ==== | ||
| + | Dal terminale del raspberry | ||
| + | < | ||
| mycroft-stop | mycroft-stop | ||
| systemctl --user stop pulseaudio | systemctl --user stop pulseaudio | ||
| Line 120: | Line 138: | ||
| Aprire alsamixer e verificare che le modifiche non siano state cancellate\\ | Aprire alsamixer e verificare che le modifiche non siano state cancellate\\ | ||
| **Nota:** il volume di master viene regolato direttamente da mycroft | **Nota:** il volume di master viene regolato direttamente da mycroft | ||
| + | |||
| + | |||
| + | ==== Skill homeassistant ==== | ||
| + | |||
| + | Dal terminale del raspberry: | ||
| + | < | ||
| + | pip install quantulum3 | ||
| + | mycroft-msm install homeassistant | ||
| + | cd ~/ | ||
| + | git pull | ||
| + | </ | ||
| + | |||
| + | * Creare un long lived access token da home assistant | ||
| + | * Andare su https:// | ||
| + | |||
| + | ==== Installazione DeepSpeech (pre addestrato) ==== | ||
| + | |||
| + | DeepSpeech è il motore STT di Mozilla\\ | ||
| + | Scaricare ed estrarre questo modello basato su DeepSpeech: | ||
| + | https:// | ||
| + | |||
| + | |||
| + | Dal terminale del raspberry: | ||
| + | < | ||
| + | sudo apt update | ||
| + | sudo apt install gfortran libatlas-base-dev libpcap-dev libpq-dev | ||
| + | |||
| + | pip install deepspeech==0.9.3 scipy av | ||
| + | mkdir deepspeech | ||
| + | cd deepspeech | ||
| + | |||
| + | # copiare in questa cartella il modello tflite e lo scorer scaricati | ||
| + | |||
| + | |||
| + | git clone https:// | ||
| + | cd deepspeech-server | ||
| + | pip install . | ||
| + | cp config.sample.json config.json | ||
| + | nano config.json | ||
| + | </ | ||
| + | |||
| + | Aggiungere a config.json: | ||
| + | < | ||
| + | ... | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | sudo nano .config/ | ||
| + | </ | ||
| + | Aggiungere a mycroft.conf: | ||
| + | < | ||
| + | ... | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | }, | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | **Creare il servizio deepspeech-server** | ||
| + | |||
| + | < | ||
| + | sudo nano / | ||
| + | </ | ||
| + | |||
| + | Scrivere nel file: | ||
| + | < | ||
| + | [Unit] | ||
| + | Description=Deepspeech server | ||
| + | |||
| + | [Service] | ||
| + | User=pi | ||
| + | Type=simple | ||
| + | ExecStart=/ | ||
| + | Restart=always | ||
| + | RestartSec=3 | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | </ | ||
| + | |||
| + | Attivare il servizio: | ||
| + | < | ||
| + | sudo systemctl enable deepspeech-server | ||
| + | sudo systemctl start deepspeech-server | ||
| + | </ | ||
| **Work in progress** | **Work in progress** | ||
| + | |||
| + | ===== Addestramento manuale di una rete neurale ===== | ||
| + | |||
| + | **ATTENZIONE**\\ | ||
| + | Prosegui solo se non vuoi usare il modello già addestrato e vuoi addestrare manualmente una rete neurale DeepSpeech.\\ | ||
| + | |||
| + | Requisiti: PC Desktop con scheda grafica nvidia | ||
| + | Assicurarsi che il sistema operativo supporti CUDA 10.0.0. Non usare versioni più recenti di cuda. | ||
| + | (Testato con Ubuntu 18.04) | ||
| + | |||
| + | Verificare se i driver nvidia sono installati: | ||
| + | < | ||
| + | nvidia-smi | ||
| + | </ | ||
| + | Questo comando dovrebbe mostrare una tabella con alcune proprietà della gpu | ||
| + | |||
| + | Installare Cuda 10.0.0, potrebbe essere necessario disinstallare i driver nvidia e reinstallarli dopo cuda\\ | ||
| + | https:// | ||
| + | |||
| + | Installare docker e nvidia-docker: | ||
| + | https:// | ||
| + | https:// | ||
| + | Prima di proseguire è consigliato fare un test per assicurarsi che docker riesca a vedere la gpu | ||
| + | |||
| + | Scaricare il dataset più recente di CommonVoice\\ | ||
| + | https:// | ||
| + | |||
| + | Dovrebbe essere un file chiamato it.tar.gz\\ | ||
| + | Posizionate l' | ||
| + | < | ||
| + | cd $HOME | ||
| + | mkdir -p data/ | ||
| + | chmod a+rwx -R data | ||
| + | mv it.tar.gz data/ | ||
| + | chmod a+r data/ | ||
| + | </ | ||
| + | |||
| + | === Creare l' | ||
| + | |||
| + | Ho preso un tool di Mozilla-Italia che semplifica l' | ||
| + | < | ||
| + | cd $HOME | ||
| + | git clone https:// | ||
| + | cd DeepSpeech-Italian-Model/ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | chmod +x generate_base_dockerfile.sh | ||
| + | ./ | ||
| + | |||
| + | docker build . -f Dockerfile.train -t deepspeech/ | ||
| + | docker build . -f Dockerfile_it.train -t deepspeech/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Avviare l' | ||
| + | |||
| + | < | ||
| + | docker run -e " | ||
| + | </ | ||
| + | |||
| + | Se il processo occupa troppa memoria della gpu potrebbe essere necessario ridurre il BATCH_SIZE, esempio: | ||
| + | < | ||
| + | docker run -e " | ||
| + | </ | ||
| + | |||