1010
1111Example (zipvoice)
1212
13- wget https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-zipvoice-distill-zh-en-emilia.tar.bz2
14- tar xf sherpa-onnx-zipvoice-distill-zh-en-emilia.tar.bz2
13+ wget https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-zipvoice-distill-int8-zh-en-emilia.tar.bz2
14+ tar xf sherpa-onnx-zipvoice-distill-int8-zh-en-emilia.tar.bz2
15+
16+ wget https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/vocos_24khz.onnx
1517
1618python3 ./python-api-examples/offline-zeroshot-tts.py \
17- --zipvoice-flow-matching-model sherpa-onnx-zipvoice-distill-zh-en-emilia/fm_decoder .onnx \
18- --zipvoice-text-model sherpa-onnx-zipvoice-distill-zh-en-emilia/text_encoder .onnx \
19- --zipvoice-data-dir sherpa-onnx-zipvoice-distill-zh-en-emilia/espeak-ng-data \
20- --zipvoice-pinyin-dict sherpa-onnx-zipvoice-distill-zh-en-emilia/pinyin.raw \
21- --zipvoice-tokens sherpa-onnx-zipvoice-distill-zh-en-emilia/tokens.txt \
22- --zipvoice-vocoder sherpa-onnx-zipvoice-distill-zh-en-emilia/ vocos_24khz.onnx \
23- --prompt-audio sherpa-onnx-zipvoice-distill-zh-en-emilia/prompt .wav \
19+ --zipvoice-flow-matching-model sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/decoder.int8 .onnx \
20+ --zipvoice-text-model sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/encoder.int8 .onnx \
21+ --zipvoice-data-dir sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/espeak-ng-data \
22+ --zipvoice-lexicon sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/lexicon.txt \
23+ --zipvoice-tokens sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/tokens.txt \
24+ --zipvoice-vocoder vocos_24khz.onnx \
25+ --prompt-audio sherpa-onnx-zipvoice-distill-int8- zh-en-emilia/test_wavs/leijun-1 .wav \
2426 --zipvoice-num-steps 4 \
2527 --num-threads 4 \
26- --prompt-text "周日被我射熄火了,所以今天是周一。 " \
27- "我是中国人民的儿子,我爱我的祖国。我得祖国是一个伟大的国家,拥有五千年的文明史。 "
28+ --prompt-text "那还是三十六年前, 一九八七年. 我呢考上了武汉大学的计算机系. " \
29+ "小米的价值观是真诚, 热爱. 真诚,就是不欺人也不自欺. 热爱, 就是全心投入并享受其中. "
2830"""
2931
3032import argparse
@@ -68,10 +70,10 @@ def add_zipvoice_args(parser):
6870 )
6971
7072 parser .add_argument (
71- "--zipvoice-pinyin-dict " ,
73+ "--zipvoice-lexicon " ,
7274 type = str ,
7375 default = "" ,
74- help = "Path to the pinyin dictionary. " ,
76+ help = "Path to the lexicon.txt " ,
7577 )
7678
7779 parser .add_argument (
@@ -236,7 +238,7 @@ def main():
236238 text_model = args .zipvoice_text_model ,
237239 flow_matching_model = args .zipvoice_flow_matching_model ,
238240 data_dir = args .zipvoice_data_dir ,
239- pinyin_dict = args .zipvoice_pinyin_dict ,
241+ lexicon = args .zipvoice_lexicon ,
240242 vocoder = args .zipvoice_vocoder ,
241243 feat_scale = args .zipvoice_feat_scale ,
242244 t_shift = args .zipvoice_t_shift ,
@@ -268,9 +270,7 @@ def main():
268270 end = time .time ()
269271
270272 if len (audio .samples ) == 0 :
271- print (
272- "Error in generating audios. Please read previous error messages."
273- )
273+ print ("Error in generating audios. Please read previous error messages." )
274274 return
275275
276276 elapsed_seconds = end - start
@@ -287,9 +287,7 @@ def main():
287287 print (f"The text is '{ args .text } '" )
288288 print (f"Elapsed seconds: { elapsed_seconds :.3f} " )
289289 print (f"Audio duration in seconds: { audio_duration :.3f} " )
290- print (
291- f"RTF: { elapsed_seconds :.3f} /{ audio_duration :.3f} = { real_time_factor :.3f} "
292- )
290+ print (f"RTF: { elapsed_seconds :.3f} /{ audio_duration :.3f} = { real_time_factor :.3f} " )
293291
294292
295293if __name__ == "__main__" :
0 commit comments