from typing import Optional, Type, Any
import torch.nn as nn
from cogdl.trainers.base_trainer import BaseTrainer
[docs]class BaseModel(nn.Module):
@staticmethod
[docs] def add_args(parser):
"""Add model-specific arguments to the parser."""
pass
@classmethod
[docs] def build_model_from_args(cls, args):
"""Build a new model instance."""
raise NotImplementedError(
"Models must implement the build_model_from_args method"
)
[docs] def _forward_unimplemented(self, *input: Any) -> None: # abc warning
pass
@staticmethod
[docs] def get_trainer(taskType: Any, args: Any) -> Optional[Type[BaseTrainer]]:
return None