Skip to content

Commit

Permalink
add --tts-rule-fsts argument at offline-tts.py (#413)
Browse files Browse the repository at this point in the history
Co-authored-by: longshiming <[email protected]>
  • Loading branch information
longshiming and longshiming committed Nov 7, 2023
1 parent a65cdc3 commit 10d6dba
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion python-api-examples/offline-tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@
--output-filename=./generated.wav \
'liliana, the most beautiful and lovely assistant of our team!'
2. Download a model
wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx
wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt
wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt
wget https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/rule.fst
python3 ./python-api-examples/offline-tts.py
--vits-model=./vits-aishell3.onnx \
--vits-lexicon=./lexicon.txt \
--vits-tokens=./tokens.txt \
--tts-rule-fsts=./rule.fst \
--sid=21 \
--output-filename=./liubei-21.wav \
"勿以恶小而为之,勿以善小而不为。惟贤惟德,能服于人。122334"
Please see
https://k2-fsa.github.io/sherpa/onnx/tts/index.html
for details.
Expand Down Expand Up @@ -56,6 +72,13 @@ def get_args():
help="Path to tokens.txt",
)

parser.add_argument(
"--tts-rule-fsts",
type=str,
default="",
help="Path to rule.fst",
)

parser.add_argument(
"--output-filename",
type=str,
Expand Down Expand Up @@ -124,7 +147,8 @@ def main():
provider=args.provider,
debug=args.debug,
num_threads=args.num_threads,
)
),
rule_fsts=args.tts_rule_fsts
)
tts = sherpa_onnx.OfflineTts(tts_config)

Expand Down

0 comments on commit 10d6dba

Please sign in to comment.