# Scanvi from scvi model saved to file

**URL:** <https://discourse.scverse.org/t/scanvi-from-scvi-model-saved-to-file/704>\
**Category:** scvi-tools\
**Created:** [August 24, 2022, 8:47am UTC](https://discourse.scverse.org/t/scanvi-from-scvi-model-saved-to-file/704 "2022-08-24T08:47:27Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![adamgayoso](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/adamgayoso/32/100_2.png) [@adamgayoso](https://discourse.scverse.org/u/adamgayoso)\
**Post date:** [August 25, 2022, 8:29pm UTC](https://discourse.scverse.org/t/scanvi-from-scvi-model-saved-to-file/704/2 "2022-08-25T20:29:35Z")

</div>

Are you saying this doesn’t work?

```auto
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

```auto
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")

```

---

_[View the full topic](https://discourse.scverse.org/t/scanvi-from-scvi-model-saved-to-file/704)._
