mirror of https://github.com/coqui-ai/TTS.git
test for synthesize.py
This commit is contained in:
parent
19d9f58009
commit
1235e54738
|
@ -27,7 +27,7 @@ def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="""Synthesize speech on command line.\n\n"""
|
description="""Synthesize speech on command line.\n\n"""
|
||||||
"""You can either use your trained model or choose a model from the provided list.\n\n"""
|
"""You can either use your trained model or choose a model from the provided list.\n\n"""
|
||||||
"""If you don't specify any models, then it uses LJSpeech based English models\n\n"""
|
"""If you don't specify any models, then it uses LJSpeech based English model.\n\n"""
|
||||||
"""
|
"""
|
||||||
# Example Runs:
|
# Example Runs:
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ def main():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# print the description if either text or list_models is not set
|
# print the description if either text or list_models is not set
|
||||||
if args.text is None and not args.list_models:
|
if args.text is None and not args.list_models and not args.list_speaker_idxs:
|
||||||
parser.parse_args(["-h"])
|
parser.parse_args(["-h"])
|
||||||
|
|
||||||
# load model manager
|
# load model manager
|
||||||
|
|
|
@ -14,3 +14,8 @@ def get_tests_input_path():
|
||||||
def get_tests_output_path():
|
def get_tests_output_path():
|
||||||
"""Returns the path to the directory for test outputs."""
|
"""Returns the path to the directory for test outputs."""
|
||||||
return os.path.join(get_tests_path(), "outputs")
|
return os.path.join(get_tests_path(), "outputs")
|
||||||
|
|
||||||
|
|
||||||
|
def run_cli(command):
|
||||||
|
exit_status = os.system(command)
|
||||||
|
assert exit_status == 0, f" [!] command `{command}` failed."
|
||||||
|
|
|
@ -5,9 +5,9 @@ import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from tests import get_tests_input_path
|
from tests import get_tests_input_path
|
||||||
from TTS.tts.utils.speakers import SpeakerManager
|
|
||||||
from TTS.speaker_encoder.model import SpeakerEncoder
|
from TTS.speaker_encoder.model import SpeakerEncoder
|
||||||
from TTS.speaker_encoder.utils.generic_utils import save_checkpoint
|
from TTS.speaker_encoder.utils.generic_utils import save_checkpoint
|
||||||
|
from TTS.tts.utils.speakers import SpeakerManager
|
||||||
from TTS.utils.audio import AudioProcessor
|
from TTS.utils.audio import AudioProcessor
|
||||||
from TTS.utils.io import load_config
|
from TTS.utils.io import load_config
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from tests import get_tests_output_path, run_cli
|
||||||
|
|
||||||
|
|
||||||
|
def test_synthesize():
|
||||||
|
"""Test synthesize.py with diffent arguments."""
|
||||||
|
output_path = os.path.join(get_tests_output_path(), "output.wav")
|
||||||
|
run_cli("tts --list_models")
|
||||||
|
|
||||||
|
# single speaker model
|
||||||
|
run_cli(f'tts --text "This is an example." --out_path "{output_path}"')
|
||||||
|
run_cli(
|
||||||
|
"tts --model_name tts_models/en/ljspeech/speedy-speech-wn"
|
||||||
|
f'--text "This is an example." --out_path "{output_path}"'
|
||||||
|
)
|
||||||
|
run_cli(
|
||||||
|
"tts --model_name tts_models/en/ljspeech/speedy-speech-wn "
|
||||||
|
"--vocoder_name vocoder_models/en/ljspeech/multiband-melgan "
|
||||||
|
f'--text "This is an example." --out_path "{output_path}"'
|
||||||
|
)
|
||||||
|
|
||||||
|
# multi-speaker model
|
||||||
|
run_cli("tts --model_name tts_models/en/vctk/sc-glow-tts --list_speaker_idxs")
|
||||||
|
run_cli(
|
||||||
|
f'tts --model_name tts_models/en/vctk/sc-glow-tts --speaker_idx "p304"'
|
||||||
|
f'--text "This is an example." --out_path "{output_path}"'
|
||||||
|
)
|
Loading…
Reference in New Issue