load_weights
optimus_dl.modules.model_transforms.load_weights
¶
LoadWeightsTransform
¶
Bases: BaseModelTransform
Source code in optimus_dl/modules/model_transforms/load_weights.py
apply(model, is_restart, checkpoint_manager, **kwargs)
¶
Load weights from a specified checkpoint path into the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
BaseModel
|
The model to load weights into. |
required |
is_restart
|
bool
|
A boolean indicating if the current run is a restart. |
required |
checkpoint_manager
|
CheckpointManager
|
The checkpoint manager instance. |
required |
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
BaseModel
|
The model with loaded weights. |
Source code in optimus_dl/modules/model_transforms/load_weights.py
LoadWeightsTransformConfig
dataclass
¶
Bases: ModelTransformConfig
Configuration for load weights model transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path
|
str
|
Path to checkpoint to load weights from. |
'???'
|
skip_on_restart
|
bool
|
Skip loading weights if this run is a restart. |
True
|