noether.core.initializers.checkpoint¶
Classes¶
Base class to initialize models from checkpoints of previous runs. Should not be used directly, but inherited by other initializers such as PreviousRunInitializer or ResumeInitializer. |
Module Contents¶
- class noether.core.initializers.checkpoint.CheckpointInitializerConfig(/, **data)¶
Bases:
noether.core.initializers.base.InitializerConfig- Parameters:
data (Any)
- kind: Literal['noether.core.initializers.CheckpointInitializer'] = None¶
- load_optim: bool = None¶
Whether or not to load the optimizer state from the checkpoint. Default is True, as this is usually used to resume a training run
- pop_ckpt_kwargs_keys: list[str] | None = None¶
which checkpoint to load. If a string is provided, must be one of (“latest”, “best_loss”). If a dictionary is provided, must contain keys “epoch”, “update”, “sample” to identify the checkpoint.
- output_path: pathlib.Path | None = None¶
Output root where the source run (identified by
run_id/stage_name) lives. WhenNone, the current run’s path provider is used to locate it, which assumes the source shares this run’soutput_path. Set explicitly bynoether-evalso that overridingoutput_pathfor the eval run doesn’t redirect source-checkpoint lookup.
- class noether.core.initializers.checkpoint.CheckpointInitializer(initializer_config, **kwargs)¶
Bases:
noether.core.initializers.base.InitializerBaseBase class to initialize models from checkpoints of previous runs. Should not be used directly, but inherited by other initializers such as PreviousRunInitializer or ResumeInitializer.
- Parameters:
initializer_config (CheckpointInitializerConfig) – configuration for the initializer. See
CheckpointInitializerConfigfor available options.**kwargs – additional arguments to pass to the parent class.
- checkpoint_tag: str | noether.core.utils.training.training_iteration.TrainingIteration¶
- run_id¶
- model_name¶
- load_optim¶
- model_info¶
- pop_ckpt_kwargs_keys¶
- stage_name¶
- init_optimizer(model)¶
Initialize the optimizer for the model if it is derived from Model.
If model is a CompositeModel, nothing happens. This is expected as CompositeModels can be arbitrarily nested and do not have an optimizer. Instead, a CompositeModel calls init_optim with all its submodels which can be of type Model or a nested CompositeModel.
- Parameters:
model (noether.core.models.ModelBase) – a model to initialize the optimizer for. Assumes the model has an attribute optim.
- Return type:
None