Skip to content

Commit a693f5a

Browse files
denicsDenis Pitzalis
and
Denis Pitzalis
authored
added support for italian (#137)
* added support for italian * removed torch optimization * removed splash * added listener for vosk * Update mycroft.conf fixed comments in pull requests * added vosk file to avoid download at first boot --------- Co-authored-by: Denis Pitzalis <denics@free.fr>
1 parent 53edcd9 commit a693f5a

File tree

17 files changed

+429
-0
lines changed

17 files changed

+429
-0
lines changed

.github/workflows/build_img_it.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: build italian headless image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- dev
8+
paths:
9+
- '.github/workflows/build_img_it.yml'
10+
- 'build_raspOVOS_it.sh'
11+
- 'overlays/it/**'
12+
13+
jobs:
14+
# Stage 1: Get Current Date and Release Name
15+
get-date-release-name:
16+
runs-on: ubuntu-20.04
17+
outputs:
18+
release_name: ${{ steps.current-date.outputs.release_name }}
19+
cache_key: ${{ steps.current-date.outputs.cache_key }}
20+
steps:
21+
- name: Get Current Date and Release Name
22+
id: current-date
23+
run: |
24+
current_date=$(date +'%Y-%m-%d')
25+
release_name="raspOVOS-italian-bookworm-arm64-lite-${current_date}"
26+
cache_key="raspOVOS-${{ github.run_id }}"
27+
echo "release_name=$release_name" >> $GITHUB_OUTPUT
28+
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
29+
30+
- name: Print outputs
31+
shell: bash
32+
run: |
33+
echo "cache_key: ${{ steps.current-date.outputs.cache_key }}"
34+
echo "release_name: ${{ steps.current-date.outputs.release_name }}"
35+
36+
# Stage 2: Build Image
37+
modify-rpi-image:
38+
runs-on: ubuntu-20.04
39+
needs: get-date-release-name
40+
outputs:
41+
image-path: ${{ steps.create-image.outputs.image-path }}
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: Configuring OVOS for Italian
47+
uses: TigreGotico/rpi-image-modifier@main
48+
id: create-image
49+
env:
50+
USER: 'ovos'
51+
PASSWORD: 'ovos'
52+
HOSTNAME: "raspOVOS"
53+
CONSTRAINTS: "https://github.com/OpenVoiceOS/ovos-releases/raw/refs/heads/main/constraints-alpha.txt"
54+
with:
55+
base-image-url: https://github.com/OpenVoiceOS/raspOVOS/releases/download/raspOVOS-DEV-bookworm-arm64-lite-2025-03-13/raspOVOS-DEV-bookworm-arm64-lite.img.xz
56+
image-path: raspOVOS-italian-bookworm-arm64-lite.img
57+
compress-with-xz: true
58+
shrink: true
59+
cache: false
60+
mount-repository: true
61+
env-vars: USER,PASSWORD,HOSTNAME,CONSTRAINTS
62+
script-path: build_raspOVOS_it.sh
63+
- name: Print outputs
64+
shell: bash
65+
run: |
66+
echo "image-path: ${{ steps.create-image.outputs.image-path }}"
67+
echo "image-size: ${{ steps.create-image.outputs.image-size }}"
68+
echo "image-sha256sum: ${{ steps.create-image.outputs.image-sha256sum }}"
69+
70+
- name: Save Image to Cache
71+
uses: actions/cache@v4
72+
with:
73+
path: .
74+
key: ${{ needs.get-date-release-name.outputs.cache_key }}
75+
76+
# Stage 3: Check if Release Exists and Create if Needed
77+
check-release-or-create:
78+
runs-on: ubuntu-20.04
79+
needs: [get-date-release-name, modify-rpi-image]
80+
outputs:
81+
release_id: ${{ steps.get-release-id.outputs.release_id }}
82+
steps:
83+
- name: Check if Release Exists
84+
id: get-release-id
85+
run: |
86+
release_name="${{ needs.get-date-release-name.outputs.release_name }}"
87+
release=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
88+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$release_name")
89+
release_id=$(echo $release | jq -r .id)
90+
if [[ "$release_id" == "null" ]]; then
91+
release=$(curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
92+
-H "Content-Type: application/json" \
93+
-d "{\"tag_name\":\"$release_name\",\"name\":\"$release_name\",\"body\":\"RaspOVOS pre-configured for English\"}" \
94+
"https://api.github.com/repos/${{ github.repository }}/releases")
95+
release_id=$(echo $release | jq -r .id)
96+
fi
97+
echo "release_id=$release_id" >> $GITHUB_OUTPUT
98+
99+
- name: Print outputs
100+
shell: bash
101+
run: |
102+
echo "release_id: ${{ steps.get-release-id.outputs.release_id }}"
103+
if [[ $release_id == "null" ]]; then
104+
echo "Failed to create release. Response: $release"
105+
exit 1
106+
fi
107+
108+
# Stage 4: Upload to Release
109+
upload-image:
110+
runs-on: ubuntu-20.04
111+
if: ${{ needs.check-release-or-create.outputs.release_id }}
112+
needs: [modify-rpi-image, check-release-or-create, get-date-release-name]
113+
steps:
114+
- name: Restore Cache for Image
115+
uses: actions/cache@v4
116+
with:
117+
path: .
118+
key: ${{ needs.get-date-release-name.outputs.cache_key }}
119+
fail-on-cache-miss: true
120+
121+
- name: Debug Cache Content
122+
run: ls .
123+
124+
- name: Upload to release
125+
uses: xresloader/upload-to-github-release@v1
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
with:
129+
file: ${{ needs.modify-rpi-image.outputs.image-path }}
130+
release_id: ${{ needs.check-release-or-create.outputs.release_id }}
131+
draft: false
132+
overwrite: true
133+
prerelease: false
134+
verbose: true

build_raspOVOS_it.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# Exit on error
3+
# If something goes wrong just stop.
4+
# it allows the user to see issues at once rather than having
5+
# scroll back and figure out what went wrong.
6+
set -e
7+
8+
## Intended to run on top of the image generated by build_raspOVOS.sh
9+
10+
# Activate the virtual environment
11+
source /home/$USER/.venvs/ovos/bin/activate
12+
13+
echo "Copying overlays..."
14+
sudo cp -rv /mounted-github-repo/overlays/it/* /
15+
16+
echo "Setting up default wifi country..."
17+
/usr/bin/raspi-config nonint do_wifi_country IT
18+
19+
echo "Installing Italian specific skills"
20+
uv pip install --no-progress ovos-core[skills-it] -c $CONSTRAINTS
21+
22+
echo "Installing Italian Citrinet plugin..."
23+
uv pip install --no-progress ovos-stt-plugin-citrinet -c $CONSTRAINTS
24+
25+
echo "Downloading Italian citrinet model..."
26+
python -c "from huggingface_hub import hf_hub_download; repo_id='neongeckocom/stt_it_citrinet_512_gamma_0_25'; subfolder='onnx'; files=['model.onnx', 'tokenizer.spm', 'preprocessor.ts']; [print(f'Downloaded {file} to {hf_hub_download(repo_id=repo_id, filename=file, subfolder=subfolder)}') for file in files]"
27+
# since script was run as root, we need to move downloaded files
28+
mkdir -p /home/ovos/.cache/huggingface/hub/
29+
mv /root/.cache/huggingface/hub/models--neongeckocom--stt_it_citrinet_512_gamma_0_25/ /home/ovos/.cache/huggingface/hub/models--neongeckocom--stt_it_citrinet_512_gamma_0_25/
30+
31+
echo "Installing Piper TTS..."
32+
uv pip install --no-progress ovos-tts-plugin-piper -c $CONSTRAINTS
33+
34+
echo "Creating system level mycroft.conf..."
35+
mkdir -p /etc/mycroft
36+
37+
echo "Ensuring permissions for $USER user..."
38+
# Replace 1000:1000 with the correct UID:GID if needed
39+
chown -R 1000:1000 /home/$USER
40+
41+
echo "Cleaning up apt packages..."
42+
apt-get --purge autoremove -y && apt-get clean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"lang": "it-IT",
3+
"system_unit": "metric",
4+
"temperature_unit": "celsius",
5+
"windspeed_unit": "km/h",
6+
"precipitation_unit": "mm",
7+
"time_format": "full",
8+
"spoken_time_format": "half",
9+
"date_format": "DMY",
10+
"listener": {
11+
"stand_up_word": "sveglia"
12+
},
13+
"hotwords": {
14+
"sveglia": {
15+
"module": "ovos-ww-plugin-vosk",
16+
"rule": "fuzzy",
17+
"samples": [
18+
"sveglia",
19+
"svegliati",
20+
"svegliarsi"
21+
],
22+
"lang": "it",
23+
"wakeup": true
24+
}
25+
},
26+
"tts": {
27+
"module": "ovos-tts-plugin-piper",
28+
"fallback_module": "",
29+
"ovos-tts-plugin-piper": {
30+
"voice": "paola-medium"
31+
}
32+
},
33+
"stt": {
34+
"module": "ovos-stt-plugin-citrinet",
35+
"fallback_module": "",
36+
"ovos-stt-plugin-citrinet": {
37+
"lang": "it"
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Small Italian model for Vosk
2+
3+
WER
4+
5+
%WER 16.88 [ 24763 / 146712, 3133 ins, 4266 del, 17364 sub ] exp/chain/tdnn/decode_test_cv_red/wer_10_0.0
6+
%WER 25.87 [ 10567 / 40847, 1725 ins, 1248 del, 7594 sub ] exp/chain/tdnn/decode_test_mls_red/wer_9_0.0
7+
%WER 17.01 [ 3091 / 18167, 695 ins, 890 del, 1506 sub ] exp/chain/tdnn/decode_test_mtedx_red/wer_10_0.0
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--use-energy=false
2+
--sample-frequency=16000
3+
--num-mel-bins=40
4+
--num-ceps=40
5+
--low-freq=40
6+
--high-freq=7800
7+
--allow-upsample=true
8+
--allow-downsample=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--min-active=200
2+
--max-active=3000
3+
--beam=10.0
4+
--lattice-beam=2.0
5+
--acoustic-scale=1.0
6+
--frame-subsampling-factor=3
7+
--endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10
8+
--endpoint.rule2.min-trailing-silence=0.5
9+
--endpoint.rule3.min-trailing-silence=0.75
10+
--endpoint.rule4.min-trailing-silence=1.0
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
9789
2+
9790
3+
9791
4+
9792
5+
9793
6+
9794
7+
9795
8+
9796
9+
9797
10+
9798
11+
9799
12+
9800
13+
9801
14+
9802
15+
9803
16+
9804
17+
9805
18+
9806
19+
9807
20+
9808
21+
9809
22+
9810
23+
9811
24+
9812
25+
9813

0 commit comments

Comments
 (0)