Are you saying this doesn’t work?
scvi.model.SCVI.setup_anndata(adata_ref, batch_key="tech", layer="counts")
vae_ref = scvi.model.SCVI(
adata_ref,
**arches_params
)
vae_ref.train()
dir_path = "pancreas_model/"
vae_ref.save(dir_path, overwrite=True)
adata_ref.write_h5ad(...)
New session
adata_ref = anndata.read_h5ad(...)
scvi_model = scvi.model.SCVI.load(dir_path, adata_ref)
scanvi_model = SCANVI.from_scvi_model(scvi_model, unlabeled_category="Unknown")