physioex.train.models.load.load_model#

physioex.train.models.load.load_model(model_class, model_kwargs, ckpt_path=None, model_name=None, device='cpu')[source]#

Load a model with dual-format checkpoint support.

Supports three checkpoint formats: - Lightning .ckpt (has “state_dict” key with “nn.” prefixed keys) - New .pt format (has “model_state_dict” key) - Raw state_dict (plain dict of parameter tensors)

Parameters:
  • model_class – A torch.nn.Module subclass, or a string “module:Class”.

  • model_kwargs (dict) – Constructor kwargs for the model class.

  • ckpt_path (str) – Path to checkpoint file. If None, uses registry lookup.

  • model_name (str) – Name for registry lookup (e.g. “seqsleepnet”).

  • device (str) – Device to load the model onto.

Returns:

The loaded model in eval mode on the specified device.

Return type:

Module