Open christophertubbs opened 1 month ago
In our fork (pip install coqui-tts
) all prints have been switched to Python logging. Feel free to try it out and let us know if it works for you. (also a duplicate of #1691)
Thanks for your work there! I wasn't aware that TTS was essentially dead here when I posted. Is there anything I need to know when migrating over to your version?
No, there aren't any major changes and you can use it in the same way.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You might also look our discussion channels.
π Feature Description
The
print
function is in several places, most noticeably (to me) is inutils.synthesizer.Synthesizer.tts
, with lines like:This is great when messing around, but it'd be nice to have the option to use different types of loggers (or even just the root). For instance, if I have a distributed application, I can have this writing to something that would send the messages through a pubsub setup so that another application may read and interpret the output in real time.
Solution
utils.synthesizer.Synthesizer
's signature can be changed to look like:and the
tts
function can look like:A
Protocol
for the logger might work better than just the hint oflogging.Logger
- it'd allow programmers to put in some wackier functionality, such as writing non-loggers that just so happen to have a similar signature.Alternative Solutions
An alternative solution would be to pass the writing function to
tts
itself, something like:This will enable code like:
Additional context
I don't believe that
utils.synthesizer.Synthesizer.tts
is the only location of the standardprint
function. A consistent solution should be applied there.The parameter for the logging functionality will need to be passed through objects and functions that lead to the current
print
statements. For instance,TTS.api.TTS.tts_to_file
would require alogging_function
parameter if it were to the function toself.synthesizer.tts
within thetts
function.The general vibe of the solutions I've provided will make sure that pre-existing code behaves no different, making the new functionality purely opt-in.
I haven't written anything using a progress bar like the one that this uses, so I can't speak up for that aside from the fact that it might need to be excluded.