Fix Tacotron num_char init

This commit is contained in:
Eren Gölge 2021-08-10 08:56:34 +00:00
parent 7eb94f760b
commit c8b9ca3d71
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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