-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update codes in api.py #3509
Closed
Closed
Update codes in api.py #3509
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
|
||
|
||
class TTS(nn.Module): | ||
"""TODO: Add voice conversion and Capacitron support.""" | ||
"""🐸TTS python interface that allows loading and using released models.""" | ||
|
||
def __init__( | ||
self, | ||
|
@@ -25,39 +25,29 @@ def __init__( | |
progress_bar: bool = True, | ||
gpu=False, | ||
): | ||
"""🐸TTS python interface that allows to load and use the released models. | ||
"""Initialize the TTS module. | ||
|
||
Example with a multi-speaker model: | ||
>>> from TTS.api import TTS | ||
>>> tts = TTS(TTS.list_models()[0]) | ||
>>> wav = tts.tts("This is a test! This is also a test!!", speaker=tts.speakers[0], language=tts.languages[0]) | ||
>>> tts = TTS(model_name=TTS().list_models().list_models()[0], gpu=gpu) | ||
>>> wav = tts.tts("This is a test!", speaker=tts.speakers[0], language=tts.languages[0]) | ||
>>> tts.tts_to_file(text="Hello world!", speaker=tts.speakers[0], language=tts.languages[0], file_path="output.wav") | ||
|
||
Example with a single-speaker model: | ||
>>> tts = TTS(model_name="tts_models/de/thorsten/tacotron2-DDC", progress_bar=False, gpu=False) | ||
>>> tts = TTS(model_name="tts_models/de/thorsten/tacotron2-DDC", progress_bar=False, gpu=gpu) | ||
>>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav") | ||
|
||
Example loading a model from a path: | ||
>>> tts = TTS(model_path="/path/to/checkpoint_100000.pth", config_path="/path/to/config.json", progress_bar=False, gpu=False) | ||
>>> tts = TTS(model_path="/path/to/checkpoint_100000.pth", config_path="/path/to/config.json", progress_bar=False, gpu=gpu) | ||
>>> tts.tts_to_file(text="Ich bin eine Testnachricht.", file_path="output.wav") | ||
|
||
Example voice cloning with YourTTS in English, French and Portuguese: | ||
>>> tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=True) | ||
>>> tts.tts_to_file("This is voice cloning.", speaker_wav="my/cloning/audio.wav", language="en", file_path="thisisit.wav") | ||
>>> tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="my/cloning/audio.wav", language="fr", file_path="thisisit.wav") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove these examples? |
||
>>> tts.tts_to_file("Isso é clonagem de voz.", speaker_wav="my/cloning/audio.wav", language="pt", file_path="thisisit.wav") | ||
|
||
Example Fairseq TTS models (uses ISO language codes in https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html): | ||
>>> tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True) | ||
>>> tts.tts_to_file("This is a test.", file_path="output.wav") | ||
|
||
Args: | ||
model_name (str, optional): Model name to load. You can list models by ```tts.models```. Defaults to None. | ||
model_name (str, optional): Model name to load. You can list models by `tts.models`. Defaults to None. | ||
model_path (str, optional): Path to the model checkpoint. Defaults to None. | ||
config_path (str, optional): Path to the model config. Defaults to None. | ||
vocoder_path (str, optional): Path to the vocoder checkpoint. Defaults to None. | ||
vocoder_config_path (str, optional): Path to the vocoder config. Defaults to None. | ||
progress_bar (bool, optional): Whether to pring a progress bar while downloading a model. Defaults to True. | ||
progress_bar (bool, optional): Whether to print a progress bar while downloading a model. Defaults to True. | ||
gpu (bool, optional): Enable/disable GPU. Some models might be too slow on CPU. Defaults to False. | ||
""" | ||
super().__init__() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the GPU parameter should be True or False here because in this way the user can easily understand the parameter.