Skip to content
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

Python API implementation #2195

Merged
merged 11 commits into from
Dec 12, 2022
Merged

Python API implementation #2195

merged 11 commits into from
Dec 12, 2022

Conversation

erogol
Copy link
Member

@erogol erogol commented Dec 7, 2022

Early-stage Python API to load and run the released 🐸TTS models.

Feel free to comment...

Copy link
Contributor

@WeberJulian WeberJulian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is a much needed PR to make TTS easier to use, thanks for doing that.
To add to the existing TODO:
Add support for voice conversion and voice cloning.

TTS/api.py Outdated
from TTS.utils.manage import ModelManager


class TTS():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know If calling it TTS is the best thing because it conflicts with the name of the package so it might prevent this kind of import: from TTS.api import TTS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why you can't import like that.

I'm also open for suggestions 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you override TTS, might be annoying if you plan on importing other stuff from TTS. But yeah not super important.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can go far by just import TTS for any use-case

Again if you have a name suggestion shoot it.

self.load_model_by_name(model_name, gpu)

@property
def models(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know a good solution, but it would be nice to be able to have that list of model before instantiating that class with the model name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could create a static method called list_tts_models and inside of it instance ModelManager and called the method list_models.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep the models in a python file instead of JSON and we can list it.

However can you give a code example for your intended use?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just read the JSON

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already what tts.models does. Are you suggesting something different?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it works only when the class is already initialized because it uses a model manager instance. But this could be avoided if models was a @staticmethod instead.

TTS/utils/manage.py Show resolved Hide resolved
@Edresson
Copy link
Contributor

Edresson commented Dec 7, 2022

Great PR :)

@erogol erogol merged commit 1ddc484 into dev Dec 12, 2022
@erogol erogol deleted the python_api branch December 12, 2022 11:04
@erogol erogol restored the python_api branch December 12, 2022 11:04
@erogol erogol deleted the python_api branch December 12, 2022 11:05
shivammehta25 pushed a commit to shivammehta25/TTS that referenced this pull request Jan 5, 2023
* Draft implementation

* Fix style

* Add api tests

* Fix lint

* Update docs

* Update tests

* Set env

* Fixup

* Fixup

* Fix lint

* Revert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants