Add init_from_config as an abstract class

This commit is contained in:
Eren Gölge 2021-11-24 18:45:32 +01:00
parent 3eca5ad060
commit 9b83e665fc
1 changed files with 10 additions and 0 deletions

View File

@ -130,6 +130,15 @@ class BaseModel(nn.Module, ABC):
"""
...
@staticmethod
@abstractmethod
def init_from_config(config: Coqpit):
"""Init the model from given config.
Override this depending on your model.
"""
pass
def get_optimizer(self) -> Union["Optimizer", List["Optimizer"]]:
"""Setup an return optimizer or optimizers."""
pass
@ -150,3 +159,4 @@ class BaseModel(nn.Module, ABC):
def format_batch(self):
pass