longshiming
Committed by GitHub

add --tts-rule-fsts argument at offline-tts.py (#413)

Co-authored-by: longshiming <longshiming@greesoft.com>
@@ -21,6 +21,22 @@ python3 ./python-api-examples/offline-tts.py \ @@ -21,6 +21,22 @@ python3 ./python-api-examples/offline-tts.py \
21 --output-filename=./generated.wav \ 21 --output-filename=./generated.wav \
22 'liliana, the most beautiful and lovely assistant of our team!' 22 'liliana, the most beautiful and lovely assistant of our team!'
23 23
  24 +2. Download a model
  25 +
  26 +wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx
  27 +wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt
  28 +wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt
  29 +wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/rule.fst
  30 +
  31 +python3 ./python-api-examples/offline-tts.py
  32 + --vits-model=./vits-aishell3.onnx \
  33 + --vits-lexicon=./lexicon.txt \
  34 + --vits-tokens=./tokens.txt \
  35 + --tts-rule-fsts=./rule.fst \
  36 + --sid=21 \
  37 + --output-filename=./liubei-21.wav \
  38 + "勿以恶小而为之,勿以善小而不为。惟贤惟德,能服于人。122334"
  39 +
24 Please see 40 Please see
25 https://k2-fsa.github.io/sherpa/onnx/tts/index.html 41 https://k2-fsa.github.io/sherpa/onnx/tts/index.html
26 for details. 42 for details.
@@ -57,6 +73,13 @@ def get_args(): @@ -57,6 +73,13 @@ def get_args():
57 ) 73 )
58 74
59 parser.add_argument( 75 parser.add_argument(
  76 + "--tts-rule-fsts",
  77 + type=str,
  78 + default="",
  79 + help="Path to rule.fst",
  80 + )
  81 +
  82 + parser.add_argument(
60 "--output-filename", 83 "--output-filename",
61 type=str, 84 type=str,
62 default="./generated.wav", 85 default="./generated.wav",
@@ -124,7 +147,8 @@ def main(): @@ -124,7 +147,8 @@ def main():
124 provider=args.provider, 147 provider=args.provider,
125 debug=args.debug, 148 debug=args.debug,
126 num_threads=args.num_threads, 149 num_threads=args.num_threads,
127 - ) 150 + ),
  151 + rule_fsts=args.tts_rule_fsts
128 ) 152 )
129 tts = sherpa_onnx.OfflineTts(tts_config) 153 tts = sherpa_onnx.OfflineTts(tts_config)
130 154