from dataclasses import dataclass from typing import Dict, List from TTS.tts.configs.vits_config import VitsConfig from coqpit import Coqpit @dataclass class CharactersConfig(Coqpit): """Defines arguments for the `BaseCharacters` or `BaseVocabulary` and their subclasses. Args: characters_class (str): Defines the class of the characters used. If None, we pick ```Phonemes``` or ```Graphemes``` based on the configuration. Defaults to None. vocab_dict (dict): Defines the vocabulary dictionary used to encode the characters. Defaults to None. pad (str): characters in place of empty padding. Defaults to None. eos (str): characters showing the end of a sentence. Defaults to None. bos (str): characters showing the beginning of a sentence. Defaults to None. blank (str): Optional character used between characters by some models for better prosody. Defaults to `_blank`. characters (str): character set used by the model. Characters not in this list are ignored when converting input text to a list of sequence IDs. Defaults to None. punctuations (str): characters considered as punctuation as parsing the input sentence. Defaults to None. phonemes (str): characters considered as parsing phonemes. This is only for backwards compat. Use `characters` for new models. Defaults to None. is_unique (bool): remove any duplicate characters in the character lists. It is a bandaid for compatibility with the old models trained with character lists with duplicates. Defaults to True. is_sorted (bool): Sort the characters in alphabetical order. Defaults to True. """ characters_class: str = None # using BaseVocabulary vocab_dict: Dict = None # using on BaseCharacters pad: str = None eos: str = None bos: str = None blank: str = None characters: List[str] = None punctuations: str = None phonemes: str = None is_unique: bool = True # for backwards compatibility of models trained with char sets with duplicates is_sorted: bool = True @dataclass class ChangedVitsConfig(VitsConfig): characters: CharactersConfig = None