noether.core.initializers.previous_run¶
Classes¶
Initializes a model from a checkpoint of a previous run (specified by the run_id), this initializers hence only loads model weights. |
Module Contents¶
- class noether.core.initializers.previous_run.PreviousRunInitializer(initializer_config, **kwargs)¶
Bases:
noether.core.initializers.CheckpointInitializerInitializes a model from a checkpoint of a previous run (specified by the run_id), this initializers hence only loads model weights. When a previous run should be resumed for further training, use ResumeInitializer instead. This initializer needs to be initialized as part of a model config. It is possible to remove certain keys or patterns from the checkpoint before loading it into the model, or to rename certain patterns.
For example:
model: kind: path.to.MyModelClass param1: value1 name: my_model initializers: - kind: noether.core.initializers.PreviousRunInitializer run_id: <run_id> model_name: transformer stage_name: train checkpoint_tag: last keys_to_remove: - encoder.block1.weight
- Parameters:
initializer_config (noether.core.schemas.initializers.PreviousRunInitializerConfig) – Configuration for the initializer. See
PreviousRunInitializerConfigfor available options.**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 (noether.core.models.ModelBase) – the model to load the weights into.
model_name (str | None)
- Return type:
None