noether.core.initializers.base¶
Classes¶
Helper class that provides a standard way to create an ABC using |
Module Contents¶
- class noether.core.initializers.base.InitializerConfig(/, **data)¶
Bases:
pydantic.BaseModel- Parameters:
data (Any)
- run_id: str¶
A unique identifier for the training stage. This is used to find the correct checkpoint.
- stage_name: str | None = None¶
The name of the stage training stage if defined. When training, the stage name is usually “train”.
- model_name: str | None = None¶
The name of the model to load. This is the model_name used in CheckpointCallback.
- checkpoint_tag: str | None | dict = None¶
Which checkpoint to load. Checkpoint is usually “latest” or “best_loss”, or “E*_U*_S*”, depending on which checkpoint you want to load.
- model_info: str | None = None¶
Optional string to provide additional info about the model weights in the checkpoint filename. E.g., the stored weights are the EMA, or in a different precision.
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class noether.core.initializers.base.InitializerBase(path_provider)¶
Bases:
abc.ABCHelper class that provides a standard way to create an ABC using inheritance.
Base class for model initializers.
- Parameters:
path_provider (noether.core.providers.PathProvider) – PathProvider instance to access paths to load models from.
- logger¶
- path_provider¶
- abstractmethod init_weights(model)¶
Initialize the model weights from the checkpoint.
- Parameters:
model (noether.core.models.base.ModelBase) – the model to load the weights into.
- Return type:
None
- abstractmethod init_optimizer(model)¶
Initialize the optimizer for the model.
- Parameters:
model (noether.core.models.base.ModelBase) – a model to initialize the optimizer for. Assumes the model has an attribute optim.
- Return type:
None
- init_trainer(trainer)¶
Initialize the trainer from the checkpoint.
By default, does nothing. Can be overridden by child classes.
- Parameters:
trainer – the trainer to initialize.
- Return type:
None
- init_callbacks(callbacks, model)¶
Initialize the callbacks from the checkpoint.
By default, does nothing. Can be overridden by child classes.
- Parameters:
callbacks (list[noether.core.callbacks.base.CallbackBase]) – the list of callbacks to initialize.
model (noether.core.models.base.ModelBase) – the model associated with the callbacks.
- Return type:
None
- start_checkpoint()¶
Get the start checkpoint for the model.
By default , returns a TrainingIteration starting from zero.
- Returns:
the start checkpoint for the model.
- Return type: