Issue with retrain scANVI model

Hi, all
After reanno all cells, I reloaded scVI model (setting labels_key=‘anno’) and set cell_type_key = 'FinalLv1'. Then setting scanvi_model =

sca.models.SCANVI.from_scvi_model(
    vae_model,
    adata=source_adata,
    labels_key=cell_type_key,
    unlabeled_category="Unknown",
)

to train a new scANVI model to predict other data. But, when predicting query adata, model.predict() returned labels were anno category. Is it possible to retrain a scANVI model? Is there anything wrong with the scVI model?

Hey,
I think you shouldn’t use the labels_key in the scVI model.
Please also validate your query data with prepare_query_anndata before applying the trained scANVI from the scVI.
See this tutorial that might help: Reference mapping with scvi-tools — scvi-tools

1 Like