vocalpy / vak

A neural network framework for researchers studying acoustic communication
https://vak.readthedocs.io
BSD 3-Clause "New" or "Revised" License
78 stars 16 forks source link

CLN: Refactor model abstraction, fix #737 #726 #753

Closed NickleDave closed 6 months ago

NickleDave commented 6 months ago

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