physioex.models.load_from_pretrained#

physioex.models.load_from_pretrained(name, device='cpu', verbose=False, repo_id=None)[source]#

Load a pretrained model from HuggingFace Hub.

The model class and constructor kwargs are read from config.json stored alongside the weights on HuggingFace. The caller only needs to know the model identifier (e.g. "seqsleepnet-huy").

Parameters:
  • name (str) – Model identifier matching a sub-folder in the HF repo (e.g. "seqsleepnet-huy").

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

  • verbose (bool) – If True, print model info and per-dataset evaluation metrics stored on HuggingFace.

  • repo_id (str)

Returns:

The pretrained nn.Module in eval mode on device.

Return type:

Module

Example:

from physioex.models import load_from_pretrained

model = load_from_pretrained("seqsleepnet-huy", verbose=True)