ar_load_weights: Load AcceleRest Model Weights

View source: R/ar_weights.R

ar_load_weightsR Documentation

Load AcceleRest Model Weights

Description

Extracts the torch state dictionary (the named parameter tensors) from a downloaded weights file.

Usage

ar_load_weights(
  model = "linear_sleepstages",
  weights_dir = ar_cache_dir(),
  as_r = TRUE
)

Arguments

model

a single model name, see ar_weights()

weights_dir

directory where the weights are (to be) stored. If NULL, the file column is just the file name.

as_r

If TRUE, convert each tensor to an R array; otherwise return the Python OrderedDict of tensors.

Value

A named list of arrays or a Python object.

Examples


  # Runs only after ar_setup(), so Python is not set up otherwise
  if (ar_have_weights("linear_sleepstages") &&
      ar_python_modules_installed()) {
    sd = ar_load_weights("linear_sleepstages")
    names(sd)[1:5]
  }


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