Skip to content

utils

load_experiment

load_experiment(exp_path, search_path=None)

Loads all configuration and metrics outputs in an experiment directory.

Parameters:

Name Type Description Default
exp_path Union[str, Path]

The directory to search for data. Directory must include the ".hydra/config.yaml" file.

required

Returns:

Name Type Description
exps Union[Experiment, List[Experiment]]

load_from_checkpoint

load_from_checkpoint(
    model,
    *,
    ckpt=None,
    weights_key=None,
    weights_key_strip=None,
    model_attr=None,
)

Load model weights.

Parameters:

Name Type Description Default
model Module

The PyTorch Module

required
ckpt Optional[Union[str, Path]]

The path to the file containing the model weights. If no path is provided the model will not be updated.

None
weights_key Optional[str] (default: "state_dict")

(load_module=False) The key from the checkpoint file containing the model weights.

None
weights_key_strip Optional[str] (default: "model")

(load_module=False) The prefix to remove from each weight's key prior to loading the module.

None
model_attr Optional[str] (default: "model")

(load_module=False) The attribute of the module containing the torch.nn.Module

None

Returns:

Name Type Description
module LightningModule