nichecompass.models.utils.load_saved_files
- nichecompass.models.utils.load_saved_files(dir_path, load_adata, adata_file_name='adata.h5ad', load_adata_atac=False, adata_atac_file_name='adata_atac.h5ad', map_location=None)
Helper to load saved model files.
Parts of the implementation are adapted from https://github.com/scverse/scvi-tools/blob/master/scvi/model/base/_utils.py#L55 (01.10.2022)
- Parameters:
dir_path (
str) – Path where the saved model files are stored.load_adata (
bool) – IfTrue, also load the stored AnnData object.adata_file_name (
str(default:'adata.h5ad')) – File name under which the AnnData object is saved.load_adata_atac (
bool(default:False)) – IfTrue, also load the stored ATAC AnnData object.adata_atac_file_name (
str(default:'adata_atac.h5ad')) – File name under which the ATAC AnnData object is saved.map_location (
Optional[Literal['cpu','cuda']] (default:None)) – Memory location where to map the model files to.
- Return type:
- Returns:
- model_state_dict:
The stored model state dict.
- var_names:
The stored variable names.
- attr_dict:
The stored attributes.
- adata:
The stored AnnData object.
- adata_atac:
The stored ATAC AnnData object.