LIONmodel.py¶

Source: LION/models/LIONmodel.py

class LION.models.LIONmodel.ModelInputType(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶

Bases: int, Enum

class LION.models.LIONmodel.LIONmodel(model_parameters, geometry=None)[source]¶

Bases: Module, ABC

Base class for all models in the toolbox,

Parameters:
  • model_parameters (LIONModelParameter | None)

  • geometry (Geometry | None)

save(fname, **kwargs)[source]¶

Saves model given a filename. While its not enforced, the following Parameters are expected from kwargs: - ‘dataset’ : LIONParameter describing the dataset creation and handling. - ‘training’: LIONParameter describing the training algorithm and procedures - ‘geometry’: If the model itself has no scan geometry parameter, but the dataset was created with some geometry

If you want to save the model for training later (i.e. checkpoiting), use save_checkpoint()

save_checkpoint(fname, epoch, loss, optimizer, training_param, **kwargs)[source]¶

This is like save, but saves a checkpoint of the model. Its essentailly a wrapper of save() with mandatory values

classmethod load(fname, *, weights_only=False, supress_warnings=False)[source]¶

Function that loads a model from memory.