Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gaoyifei1122 opened this issue Sep 2, 2024 · 2 comments
Open

Comments

@gaoyifei1122
Copy link

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
Copy link
Member

Koncopd commented Sep 2, 2024

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

@gaoyifei1122
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants