We replace vak.models.base.Model, that sub-classed lightning.LightningModule, with vak.models.factory.ModelFactory, that no longer sub-classes LightningModule. Instead, its __init__ takes a model definition and a model family, the latter of which is a lightning.LightningModule, and its from_config and from_instances methods return new instances of the family, with instances of the network, loss, optimizer, and metrics attributes of the definition.
This is really just a shim, in the form of several layers of indirection, to fix the broken logging for now. I'm not sure it makes it much easier to add a model (see #751).
But it does appear to fix the logging issue--logs look as expected when I inspect them now.
This PR refactors the model abstraction, basically as described here: https://github.com/vocalpy/vak/issues/737#issuecomment-2094911335
We replace
vak.models.base.Model
, that sub-classedlightning.LightningModule
, withvak.models.factory.ModelFactory
, that no longer sub-classesLightningModule
. Instead, its__init__
takes a model definition and a model family, the latter of which is alightning.LightningModule
, and itsfrom_config
andfrom_instances
methods return new instances of thefamily
, with instances of thenetwork
,loss
,optimizer
, andmetrics
attributes of the definition.This is really just a shim, in the form of several layers of indirection, to fix the broken logging for now. I'm not sure it makes it much easier to add a model (see #751).
But it does appear to fix the logging issue--logs look as expected when I inspect them now.