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

Fix a division by zero error, happens quite often during multilingual automated inference #2925

Closed
wants to merge 1 commit into from

Conversation

Mrw33554432
Copy link

@Mrw33554432 Mrw33554432 commented Sep 5, 2023

fix an annoying bug (minor), happens quite often when running coquiTTS automatically
print(f" > Real-time factor: {process_time / audio_time}")
to
print(f" > Real-time factor: {process_time / audio_time if audio_time != 0 else 'undefined'}")
It will happen whenever the sentence split function produce empty string, or empty string is entered by accident, which cause audio_time=0

@CLAassistant
Copy link

CLAassistant commented Sep 5, 2023

CLA assistant check
All committers have signed the CLA.

@Mrw33554432
Copy link
Author

Perhaps a better way is catch the whole stats code block with a try catch block. I am not sure if this is the only problem here (As most of errors I encountered happened outside the main TTS function).

@Mrw33554432 Mrw33554432 changed the title Fix a division by zero error, happens quite often Fix a division by zero error, happens quite often during multilingual automated inference Sep 18, 2023
@WeberJulian
Copy link
Contributor

Hey, thanks for sending a PR. I think the real issue here is that no inference should happen with an empty string.
So a better fix would be to raise an error if the full input text is empty. Otherwise, we should remove the empty strings in sens for the resulting sens = self.split_into_sentences(text). Do you wanna make this change or should we do it?

@Mrw33554432
Copy link
Author

Mrw33554432 commented Sep 19, 2023

Hey, thanks for sending a PR. I think the real issue here is that no inference should happen with an empty string.
So a better fix would be to raise an error if the full input text is empty. Otherwise, we should remove the empty strings in sens for the resulting sens = self.split_into_sentences(text). Do you wanna make this change or should we do it?

Unfortunately I am not familiar with the code you pointed out, so it will be nice if you can take a minute or two to fix it - it should be simple.
Additional, it will be really nice if there is a feature that changes errors from unimportant code blocks into warnings, without interrupting running program (especially when we are trying to deploy it, a logged warning is so much better than an error, as long as next function call can still work correctly) I might look into that in future days.

@stale
Copy link

stale bot commented Oct 19, 2023

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.

@stale stale bot added the wontfix This will not be worked on but feel free to help. label Oct 19, 2023
@stale stale bot closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on but feel free to help.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants