scgen.SCGEN.load¶
- classmethod SCGEN.load(dir_path, adata=None, use_gpu=None, accelerator='auto', device='auto', prefix=None, backup_url=None)¶
Instantiate a model from the saved output.
- Parameters
- dir_path
str
Path to saved outputs.
- adata
AnnData
|MuData
|None
Union
[AnnData
,MuData
,None
] (default:None
) AnnData organized in the same way as data used to train model. It is not necessary to run setup_anndata, as AnnData is validated against the saved scvi setup dictionary. If None, will check for and load anndata saved with the model.
- use_gpu
str
|int
|bool
|None
Union
[str
,int
,bool
,None
] (default:None
) Use default GPU if available (if True), or index of GPU to use (if int), or name of GPU (if str, e.g., ‘cuda:0’), or use CPU (if False). Passing in use_gpu!=None will override accelerator and devices arguments. This argument is deprecated in v1.0 and will be removed in v1.1. Please use accelerator and devices instead.
- accelerator
str
(default:'auto'
) Supports passing different accelerator types (“cpu”, “gpu”, “tpu”, “ipu”, “hpu”, “mps, “auto”) as well as custom accelerator instances.
- device
int
|str
Union
[int
,str
] (default:'auto'
) The device to use. Can be set to a non-negative index (int or str) or “auto” for automatic selection based on the chosen accelerator. If set to “auto” and accelerator is not determined to be “cpu”, then device will be set to the first available device.
- prefix
str
|None
Optional
[str
] (default:None
) Prefix of saved file names.
- backup_url
str
|None
Optional
[str
] (default:None
) URL to retrieve saved outputs from if not present on disk.
- dir_path
- Returns
Model with loaded state dictionaries.
Examples
>>> model = ModelClass.load(save_path, adata) # use the name of the model class used to save >>> model.get_....