-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
wandb sweeps integration for hyperparameter optimization #1124
Comments
An optional key under "wandb" should quite reasonable. I have not played with wandb searching but in other frame work like comet.ml, the hyperparameter searching is a very smallish JSON snippet to define the searching range/values etc. |
@naga-karthik @kiristern is there any update on this issue? What is your current strategy to wandb sweep with ivadomed? |
I'm thinking, as a "short term" solution, we could maybe come up with a Python wrapper that would generate a config file on the fly (based on an input template, replacing the hyperparameter to be swept), and launch ivadomed inside the wrapper? And this wrapper could eventually replace https://github.com/ivadomed/ivadomed/blob/master/ivadomed/scripts/automate_training.py, unless some people are using it? |
Sorry, there has not been any update on this yet. Will take up now. I have only used sweeps from the CLI where we have run Given this, it appears that launching ivadomed within a python script as you suggested is a decent solution (not a short-term one). I will take a look how this can be done. |
There is one issue that I realized just now. How wandb sweeps work is that based on the hyperparameters ranges you specify, the wandb agents create various combinations on their own to run different models (the yaml file also contains the path to Now, with our solution, if we define the python wrapper containing the hyperparameter ranges and we're calling ivadomed ourselves, then there is no point of calling |
Right-- this was my understanding as well. But my idea was to let wandb sweep, retrieve the parameters at each 'sweep loop' (is that possible), generate an ivadomed config file with the params at a given iteration, and launch ivadomed. |
Aha!
This is exactly where the problem is. Once we run One workaround I could think of is as follows: Do not think about wandb sweeps for the moment and essentially borrow the training process from |
Hum, this is not great because the visualization offered by wandb-sweep is extremely useful. I'm still wondering if there is some modularity in wandb-sweep (which is not shown in the basic example from the website) that would allow us to use it with ivadomed. A bit more digging is necessary, to make sure we are not missing a good opportunity here. Also tagging @kiristern @kanishk16 @dyt811 so they can help digging. |
@jcohenadad I looked into this a bit more and seems like my understanding of sweeps was incomplete. Here's a picture of how it works, which I pulled from one of their issues on GH here. It appears that |
I'm not sure I agree with your analysis @naga-karthik . Looking at an example code for Pytorch, the key wandb elements are already integrated in ivadomed's training API: Line 74 in f066b2e
Line 183 in f066b2e
So my guess is that we would "just" need to implement the wandb sweep functionality into the training API, unless I am missing something? |
TL;DR What I actually did
where, Now,
This is a problem because we don't want CLI inputs be running from our training API. As suggested in the wandb docs, the best way to use Sweeps is to run these commands separately on CLI or from a Jupyter notebook. Bottomline is that sweeps integration is not trivial because of the rigidity in how wandb itself provided this feature. |
I see. Have you tried using Sweep's API? Also, from wandb/wandb#2282 (comment), have you tried:
There might also be possibilities to use wandb's sweep via a local controller. Don't hesitate to also open an issue on wandb's repository, to explain what we would like to do. If there is a quick solution (or a 'no go'), it would save us a lot of time. |
Motivation for the feature
Models take a long time to train, therefore integrating sweeps for model hyperparameter tuning will help us converge towards the best model more quickly.
Description of the feature
Wondering if sweeps parameters can/should be specified directly in the
config.json
, for example:See sweep config for more details
Alternatives
Other hyperparameter optimization frameworks: optuna and sigopt (probably there are others but these were some that were suggested in the lab meeting). However, I think wandb sweeps would integrate the best, given it's already set up.
The text was updated successfully, but these errors were encountered: