theislab / scarches

Reference mapping for single-cell genomics
https://docs.scarches.org/en/latest/
BSD 3-Clause "New" or "Revised" License
335 stars 51 forks source link

TypeError: __init__() got an unexpected keyword argument 'n_epochs' #249

Open gaoyifei1122 opened 2 months ago

gaoyifei1122 commented 2 months ago

Hi, I really love scArches, but I'm encountering a problem. I want to train my scVI models with the following parameters: early_stopping_kwargs = { "early_stopping_metric": "accuracy", "save_best_state_metric": "accuracy", "on": "full dataset", "patience": 10, "threshold": 0.001, "reduce_lr_on_plateau": True, "lr_patience": 8, "lr_factor": 0.1, } Here's how I set up and train the model: sca.models.SCVI.setup_anndata(source_adata, batch_key=condition_key, labels_key=cell_type_key) vae = sca.models.SCVI( source_adata, n_layers=2, encode_covariates=True, deeply_inject_covariates=False, use_layer_norm="both", use_batch_norm="none", ) vae.train(n_epochs=200, frequency=1, early_stopping_kwargs=early_stopping_kwargs) However, I receive the following error: : TypeError: init() got an unexpected keyword argument 'n_epochs' Could this issue be related to version compatibility? I am using scarches-0.5.4 and scvi-tools version 1.1.6. Plz help!

Koncopd commented 2 months ago

Hi, for recent versions of scvi it is max_epochs, not n_epochs.

gaoyifei1122 commented 2 months ago

Hi, for recent versions of scvi it is max_epochs, not n_epochs.

Thank you for your reply! I’m wondering which version can train models like this: vae.train(n_epochs=200, frequency=1, early_stopping_kwargs=early_stopping_kwargs) I want to test these parameters to see how well they perform with my data. Or are there any current methods that can replace these original parameters? I looked through the method but couldn’t find them.