noether.core.initializers.previous_run

Classes

PreviousRunInitializer

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.CheckpointInitializer

Initializes 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:
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:
Return type:

None