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

Trainer.hyperparameter_search kwargs parameter has an inexact definition if using Optuna #34239

Open
GuillemGSubies opened this issue Oct 18, 2024 · 1 comment

Comments

@GuillemGSubies
Copy link
Contributor

According to the docs, those kwargs will only be used in the create_study method in Optuna.

However that is not exactly true, as we can see in run_hp_search_optuna. Some parameters from those kwargs will end up being used in the optimize method (which is great because it is what I wanted to do but the docs said I could not do it).

n_jobs = kwargs.pop("n_jobs", 1)

study.optimize(_objective, n_trials=n_trials, timeout=timeout, n_jobs=n_jobs, gc_after_trial=gc_after_trial)

I didn't check ray or sigopt but I guess that something similar can be happening.

I don't really know what would be a good solution given that not every parameter in optimize is used and creating a kwargs_optimize would not make sense given that you support 2 other backends. Maybe a simple list of accepted paramters in the docstring?

If you tell me what solution would be the best, I could send a PR.

@stevhliu

@GuillemGSubies GuillemGSubies changed the title Trainer.hyperparameter_search kargs parameters has an inexact definition if using Optuna Trainer.hyperparameter_search kwargs parameters has an inexact definition if using Optuna Oct 18, 2024
@GuillemGSubies GuillemGSubies changed the title Trainer.hyperparameter_search kwargs parameters has an inexact definition if using Optuna Trainer.hyperparameter_search kwargs parameter has an inexact definition if using Optuna Oct 18, 2024
@stevhliu
Copy link
Member

Hey, thanks for pointing out the discrepancy! I think your proposed solution of a list of accepted parameters in the docstring would be the simplest fix 🙂

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

No branches or pull requests

3 participants