vak.models.decorator.model¶
- vak.models.decorator.model(family: LightningModule)[source]¶
Decorator that makes a
vak.models.ModelFactory, given a definition of the model, and alightning.LightningModulethat represents a family of models that the new model belongs to.The function returns a new instance of
vak.models.ModelFactory, that can create new instances of the model with itsfrom_config()andfrom_instances()methods.- Parameters:
definition (type) – The definition of the new model that will be made. A class with all the class variables required by
vak.models.definition.validate(). See docstring of that function for specification. See alsovak.models.definition.ModelDefinition, but note that it is not necessary to subclassModelDefinitionto define a model.family (lightning.LightningModule) – The class representing the family of models that the new model will belong to. E.g.,
vak.models.FrameClassificationModel. Should be a subclass oflightning.LightningModulethat was registered with thevak.models.registry.model_family()decorator.
- Returns:
model_factory – An instance of
ModelFactory, with attributedefinitionandfamily, that will be used when making new instances of the model by calling thefrom_config()method or thefrom_instances()method.- Return type:
vak.models.ModelFactory