@@ -3,7 +3,7 @@ name: export-kokoro-to-onnx
33on :
44 push :
55 branches :
6- - export-kokoro
6+ - export-kokoro-2
77
88 workflow_dispatch :
99
2020 fail-fast : false
2121 matrix :
2222 os : [ubuntu-latest]
23- version : ["0.19", "1.0"]
23+ version : ["0.19", "1.0", "1.1-zh" ]
2424 python-version : ["3.10"]
2525
2626 steps :
3434 - name : Install Python dependencies
3535 shell : bash
3636 run : |
37- pip install "numpy<=1.26.4" onnx==1.16.0 onnxruntime==1.17.1 librosa soundfile piper_phonemize -f https://k2-fsa.github.io/icefall/piper_phonemize.html misaki[en] misaki[zh] torch==2.6.0+cpu -f https://download.pytorch.org/whl/torch
37+ pip install kokoro "numpy<=1.26.4" onnx==1.16.0 onnxruntime==1.17.1 librosa soundfile piper_phonemize -f https://k2-fsa.github.io/icefall/piper_phonemize.html misaki[en] misaki[zh] torch==2.6.0+cpu -f https://download.pytorch.org/whl/torch
3838
3939 - name : Run
4040 shell : bash
4949 elif [[ $v == "1.0" ]]; then
5050 cd v1.0
5151 ./run.sh
52+ elif [[ $v == "1.1-zh" ]]; then
53+ cd v1.1-zh
54+ ./run.sh
55+ else
56+ echo "Unknown version $v"
57+ exit 1
5258 fi
5359
54- - name : Collect results ${{ matrix.version }}
60+ - name : Collect results 0.19
5561 if : matrix.version == '0.19'
5662 shell : bash
5763 run : |
7177
7278 ls -lh $d.tar.bz2
7379
74- - name : Collect results ${{ matrix.version }}
80+ - name : Collect results 1.0
7581 if : matrix.version == '1.0'
7682 shell : bash
7783 run : |
8793
8894 d=kokoro-multi-lang-v1_0
8995 mkdir $d
90- cp -a LICENSE $d/LICENSE
96+ cp -v LICENSE $d/LICENSE
9197 cp -a espeak-ng-data $d/
9298 cp -v $src/kokoro.onnx $d/model.onnx
9399 cp -v $src/voices.bin $d/
@@ -105,7 +111,63 @@ jobs:
105111
106112 ls -lh $d.tar.bz2
107113
108- - name : Publish to huggingface ${{ matrix.version }}
114+ - name : Collect results 1.1-zh
115+ if : matrix.version == '1.1-zh'
116+ shell : bash
117+ run : |
118+ curl -SL -O https://github.com/csukuangfj/cppjieba/releases/download/sherpa-onnx-2024-04-19/dict.tar.bz2
119+ tar xvf dict.tar.bz2
120+ rm dict.tar.bz2
121+
122+ curl -SL -o date-zh.fst https://huggingface.co/csukuangfj/icefall-tts-aishell3-vits-low-2024-04-06/resolve/main/data/date.fst
123+ curl -SL -o number-zh.fst https://huggingface.co/csukuangfj/icefall-tts-aishell3-vits-low-2024-04-06/resolve/main/data/number.fst
124+ curl -SL -o phone-zh.fst https://huggingface.co/csukuangfj/icefall-tts-aishell3-vits-low-2024-04-06/resolve/main/data/phone.fst
125+
126+ src=scripts/kokoro/v1.1-zh
127+
128+ d=kokoro-multi-lang-v1_1
129+ mkdir $d
130+ cp -v LICENSE $d/LICENSE
131+ cp -a espeak-ng-data $d/
132+ cp -v $src/kokoro.onnx $d/model.onnx
133+ cp -v $src/voices.bin $d/
134+ cp -v $src/tokens.txt $d/
135+ cp -v $src/lexicon*.txt $d/
136+ cp -v $src/README.md $d/README.md
137+ cp -av dict $d/
138+ cp -v ./*.fst $d/
139+ ls -lh $d/
140+ echo "---"
141+ ls -lh $d/dict
142+
143+ tar cjfv $d.tar.bz2 $d
144+ rm -rf $d
145+ ls -lh $d.tar.bz2
146+
147+ d=kokoro-int8-multi-lang-v1_1
148+ mkdir $d
149+ cp -v LICENSE $d/LICENSE
150+ cp -a espeak-ng-data $d/
151+ cp -v $src/kokoro.int8.onnx $d/model.int8.onnx
152+ cp -v $src/voices.bin $d/
153+ cp -v $src/tokens.txt $d/
154+ cp -v $src/lexicon*.txt $d/
155+ cp -v $src/README.md $d/README.md
156+ cp -av dict $d/
157+ cp -v ./*.fst $d/
158+ ls -lh $d/
159+ echo "---"
160+ ls -lh $d/dict
161+
162+ tar cjfv $d.tar.bz2 $d
163+ rm -rf $d
164+ ls -lh $d.tar.bz2
165+
166+ echo "---"
167+ ls -lh *.tar.bz2
168+
169+
170+ - name : Publish to huggingface 0.19
109171 if : matrix.version == '0.19'
110172 env :
111173 HF_TOKEN : ${{ secrets.HF_TOKEN }}
@@ -154,7 +216,7 @@ jobs:
154216 git commit -m "add models"
155217 git push https://csukuangfj:[email protected] /csukuangfj/kokoro-en-v0_19 main || true 156218
157- - name : Publish to huggingface ${{ matrix.version }}
219+ - name : Publish to huggingface 1.0
158220 if : matrix.version == '1.0'
159221 env :
160222 HF_TOKEN : ${{ secrets.HF_TOKEN }}
@@ -205,6 +267,108 @@ jobs:
205267 git commit -m "add models"
206268 git push https://csukuangfj:[email protected] /csukuangfj/kokoro-multi-lang-v1_0 main || true 207269
270+ - name : Publish to huggingface 1.1-zh
271+ if : matrix.version == '1.1-zh'
272+ env :
273+ HF_TOKEN : ${{ secrets.HF_TOKEN }}
274+ uses : nick-fields/retry@v3
275+ with :
276+ max_attempts : 20
277+ timeout_seconds : 200
278+ shell : bash
279+ command : |
280+ git config --global user.email "[email protected] " 281+ git config --global user.name "Fangjun Kuang"
282+
283+ rm -rf huggingface
284+ export GIT_LFS_SKIP_SMUDGE=1
285+ export GIT_CLONE_PROTECTION_ACTIVE=false
286+
287+ git clone https://csukuangfj:[email protected] /csukuangfj/kokoro-multi-lang-v1_1 huggingface 288+ cd huggingface
289+ rm -rf ./*
290+ git fetch
291+ git pull
292+
293+ git lfs track "cmn_dict"
294+ git lfs track "ru_dict"
295+ git lfs track "*.wav"
296+ git lfs track "lexicon*.txt"
297+
298+ cp -a ../espeak-ng-data ./
299+
300+ cp -v ../scripts/kokoro/v1.1-zh/kokoro.onnx ./model.onnx
301+
302+
303+ cp -v ../scripts/kokoro/v1.1-zh/tokens.txt .
304+ cp -v ../scripts/kokoro/v1.1-zh/voices.bin .
305+ cp -v ../scripts/kokoro/v1.1-zh/lexicon*.txt .
306+ cp -v ../scripts/kokoro/v1.1-zh/README.md ./README.md
307+ cp -v ../LICENSE ./
308+ cp -av ../dict ./
309+ cp -v ../*.fst ./
310+
311+ git lfs track "*.onnx"
312+ git add .
313+
314+ ls -lh
315+
316+ git status
317+
318+ git commit -m "add models"
319+ git push https://csukuangfj:[email protected] /csukuangfj/kokoro-multi-lang-v1_1 main || true 320+
321+ - name : Publish to huggingface 1.1-zh-int8
322+ if : matrix.version == '1.1-zh'
323+ env :
324+ HF_TOKEN : ${{ secrets.HF_TOKEN }}
325+ uses : nick-fields/retry@v3
326+ with :
327+ max_attempts : 20
328+ timeout_seconds : 200
329+ shell : bash
330+ command : |
331+ git config --global user.email "[email protected] " 332+ git config --global user.name "Fangjun Kuang"
333+
334+ rm -rf huggingface
335+ export GIT_LFS_SKIP_SMUDGE=1
336+ export GIT_CLONE_PROTECTION_ACTIVE=false
337+
338+ git clone https://csukuangfj:[email protected] /csukuangfj/kokoro-int8-multi-lang-v1_1 huggingface 339+ cd huggingface
340+ rm -rf ./*
341+ git fetch
342+ git pull
343+
344+ git lfs track "cmn_dict"
345+ git lfs track "ru_dict"
346+ git lfs track "*.wav"
347+ git lfs track "lexicon*.txt"
348+
349+ cp -a ../espeak-ng-data ./
350+
351+ cp -v ../scripts/kokoro/v1.1-zh/kokoro.int8.onnx ./model.int8.onnx
352+
353+
354+ cp -v ../scripts/kokoro/v1.1-zh/tokens.txt .
355+ cp -v ../scripts/kokoro/v1.1-zh/voices.bin .
356+ cp -v ../scripts/kokoro/v1.1-zh/lexicon*.txt .
357+ cp -v ../scripts/kokoro/v1.1-zh/README.md ./README.md
358+ cp -v ../LICENSE ./
359+ cp -av ../dict ./
360+ cp -v ../*.fst ./
361+
362+ git lfs track "*.onnx"
363+ git add .
364+
365+ ls -lh
366+
367+ git status
368+
369+ git commit -m "add models"
370+ git push https://csukuangfj:[email protected] /csukuangfj/kokoro-int8-multi-lang-v1_1 main || true 371+
208372 - name : Release
209373 if : github.repository_owner == 'csukuangfj'
210374 uses : svenstaro/upload-release-action@v2
0 commit comments