ar_load_model: Load the AcceleRest Model

View source: R/estimate_rest.R

ar_load_modelR Documentation

Load the AcceleRest Model

Description

Builds the multi-head AcceleRest model from downloaded code and weights (see ar_setup()). All heads share a single encoder backbone.

Usage

ar_load_model(
  model = NULL,
  repo_dir = ar_cache_dir(),
  weights_dir = ar_cache_dir(),
  device = NULL
)

Arguments

model

the prediction heads to include, one or more of "linear_sleepstages", "lstm_sleepstages", and "linear_respevents". Defaults to all three.

repo_dir

directory with the downloaded code, see ar_download_repo()

weights_dir

directory with the downloaded weights, see ar_download_weights()

device

torch device, e.g. "cpu", "cuda", or "mps". If NULL, uses "cuda" if available, otherwise "cpu".

Value

A Python torch module.

Examples


  # Runs only after ar_setup(), so Python is not set up otherwise
  if (ar_have_repo() && ar_have_weights("linear_sleepstages") &&
      ar_python_modules_installed()) {
    model = ar_load_model("linear_sleepstages")
  }


rester documentation built on Nov. 13, 2026, 1:06 a.m.