-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Modify Trial when using a Sweeper #2293
Comments
For reference, there is some related discussion in #1710. |
@mkardas, what is the use-case for modifying the trial object after training the model? |
@Jasha10 did you mean @michelkok? |
Yes, I did mean @michelkok! Sorry about the ping Marcin! |
For example, to attach User Attributes. |
Since Hydra is abstracting the underlying sweeper, it does not seem likely that this can be supported.
|
Sorry, I'm only coming back to this now. Is there any other way to achieve what I want? Again, the main thing is that I'm struggling to find back the model + parameters of the best run after a sweep.
Going from step 2 to 3 seems really hard since the trial object itself contains only a bit of information and it cannot be modified. Another approach I have tried for example is using the experimental |
🚀 Feature Request
A way to modify a
Trial
object while using a sweeper.Motivation
Using a sweeper the
Trial
object is not accessible from Python code anywhere.A potential use case is the setting of User Attributes before or after the Sweeper launched the Trial. For example, when doing hyperparameter optimization I use the Optuna sweeper plugin. The
Study
gives me back the bestTrial
with the optimal configuration. To find my model (that is stored in a separate database), I do not want to retrain my model with the optimal setup. I'd rather just extract the reference ID of this model. User Attributes seems like a logical place to store such information. However, using the sweeper there is no way to set these as theTrial
object is not accessible.I have tried asking on StackOverflow but no answer was given. Then I looked through the codebase and it just seems impossible at the moment (unless I am missing something).
Pitch
Describe the solution you'd like
Ideally, I'd like the
Trial
object to be available within the main function. Something along these lines:Describe alternatives you've considered
An alternative could be to provide some callback function that can be used to modify the
Trial
object likecustom_search_space
. I like this less though, as there is no control over when to modify theTrial
(e.g., the function below is called before actually computing anything - in my example, I'd like to use it after training my model).I have even tried to implement this for my use case but this is really just a hack and not a solution as the function is clearly not intended to do the stuff I'm doing here.
Are you willing to open a pull request? (See CONTRIBUTING)
Yes, but I am not familiar with most of the codebase. But for relatively simple changes, sure!
The text was updated successfully, but these errors were encountered: