ksuit.initializers.previous_run_initializer¶
Classes¶
Initializes a model from a checkpoint of a previous run (specified by the run_id), this initializers assumes that the previous run is over, and hence only loads model weights. |
Module Contents¶
- class ksuit.initializers.previous_run_initializer.PreviousRunInitializer(initializer_config, **kwargs)¶
Bases:
ksuit.initializers.base.CheckpointInitializerInitializes a model from a checkpoint of a previous run (specified by the run_id), this initializers assumes that the previous run is over, and hence only loads model weights. When a previous run should be resumed for further training, use ResumeInitializer instead.
Example
- ```yaml
- model:
… # model config dim: 64 initializers:
kind: ksuit.initializers.PreviousRunInitializer model_info: ema=0.9999 checkpoint: latest model_name: pointnet run_id: 2025-11-01_8zlau
When training, the stage name is usually “train”. Checkpoint is usually “latest” or “best_loss”, depending on which checkpoint you want to load. Model_info is an optional string that is used as suffix in the checkpoint filename. Model_name is the name of the model to load, which should match the model_name used in CheckpointCallback during the previous run. :param initializer_config: Configuration for the initializer. Implements PreviousRunInitializerConfig schema. :param **kwargs: additional arguments to pass to the parent class.
Initialize model from checkpoint.
- Parameters:
initializer_config (ksuit.schemas.initializers.PreviousRunInitializerConfig) – configuration for the initializer. Implements the CheckpointInitializerConfig schema.
**kwargs (dict) – additional arguments to pass to the parent class.
- keys_to_remove¶
- patterns_to_remove¶
- patterns_to_rename¶
- patterns_to_instantiate¶
- init_weights(model, model_name=None)¶
Initialize the model weights from the checkpoint.
- Parameters:
model (ksuit.models.model_base.ModelBase) – the model to load the weights into.
model_name (str | None)
- Return type:
None