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

Setting the synthesizer sentence segmenter for a given language #324

Open
polirritmico opened this issue Mar 1, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@polirritmico
Copy link

Hi! Great project.

Currently the pySBD segmenter is hardcoded to english:

class Synthesizer(nn.Module):
    def __init__(
        self,
        *,
        tts_checkpoint: str | os.PathLike[Any] | None = None,
        tts_config_path: str | os.PathLike[Any] | None = None,
        tts_speakers_file: str | os.PathLike[Any] | None = None,
        tts_languages_file: str | os.PathLike[Any] | None = None,
        vocoder_checkpoint: str | os.PathLike[Any] | None = None,
        vocoder_config: str | os.PathLike[Any] | None = None,
        encoder_checkpoint: str | os.PathLike[Any] | None = None,
        encoder_config: str | os.PathLike[Any] | None = None,
        vc_checkpoint: str | os.PathLike[Any] | None = None,
        vc_config: str | os.PathLike[Any] | None = None,
        model_dir: str | os.PathLike[Any] | None = None,
        voice_dir: str | os.PathLike[Any] | None = None,
        use_cuda: bool = False,
    ) -> None:
        # etc.
        self.seg = self._get_segmenter("en")

It would be great if that parameter could be set somehow. I don't fully understand the api, so I can't confidently suggest an appropriate approach to achieve this, but maybe following the language arg in the tts_to_file call?

Thanks.

@eginhard eginhard added the enhancement New feature or request label Mar 3, 2025
@eginhard
Copy link
Member

eginhard commented Mar 3, 2025

Yes, if the output of that is not appropriate for your language, the best workaround would be to split the input into sentences yourself and pass them to Coqui separately.

In terms of improvements, the most useful would probably be to also allow passing a user-defined sentence splitter. I'm unlikely to work on this myself though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants