diff --git a/TTS/tts/models/tacotron.py b/TTS/tts/models/tacotron.py index f7969b19..84a256d5 100644 --- a/TTS/tts/models/tacotron.py +++ b/TTS/tts/models/tacotron.py @@ -23,8 +23,8 @@ class Tacotron(BaseTacotron): def __init__(self, config: Coqpit): super().__init__(config) - self.num_chars, self.config = self.get_characters(config) - config.num_chars = self.num_chars + chars, self.config = self.get_characters(config) + config.num_chars = self.num_chars = len(chars) # pass all config fields to `self` # for fewer code change diff --git a/TTS/vocoder/models/__init__.py b/TTS/vocoder/models/__init__.py index 7c209af4..edc94d72 100644 --- a/TTS/vocoder/models/__init__.py +++ b/TTS/vocoder/models/__init__.py @@ -24,8 +24,10 @@ def setup_model(config: Coqpit): elif config.model.lower() == "wavegrad": MyModel = getattr(MyModel, "Wavegrad") else: - MyModel = getattr(MyModel, to_camel(config.model)) - raise ValueError(f"Model {config.model} not exist!") + try: + MyModel = getattr(MyModel, to_camel(config.model)) + except ModuleNotFoundError as e: + raise ValueError(f"Model {config.model} not exist!") from e model = MyModel(config) return model