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

bug(logger): wandb fails on sweep #1290

Closed
AmitMY opened this issue Mar 30, 2020 · 6 comments · Fixed by #1512
Closed

bug(logger): wandb fails on sweep #1290

AmitMY opened this issue Mar 30, 2020 · 6 comments · Fixed by #1512
Labels
bug Something isn't working help wanted Open to be worked on logger Related to the Loggers

Comments

@AmitMY
Copy link

AmitMY commented Mar 30, 2020

🐛 Bug

When using wandb sweeps for hyperparameters search, I get this error:

wandb: ERROR Attempted to change value of key "dropout_std" from 0.030424838979365657 to 0.030424838979365654

The reason is I ran:

wandb_logger.log_hyperparams(params)

Which I guess has some problem with floating-point numbers in high accuracy?

@AmitMY AmitMY added bug Something isn't working help wanted Open to be worked on labels Mar 30, 2020
@amoudgl
Copy link
Contributor

amoudgl commented Mar 30, 2020

+1, I faced the same issue when using pytorch lightning with wandb sweeps. To summarize, wandb automatically logs hyperparams when we run the wandb sweep agent on a machine. Later, pytorch lightning again tries to log same hyperparams but due to precision error between lightning and wandb already logged hyperparams, wandb throws this error. Just a guess: wandb sweep agent might be using double format to generate new hyperparams and when lightning receives those args from command line, it converts them to float and tries to log it. I haven't digged in detail where these hyperparams get altered, it could be on wandb side or lightning side.

I reported this issue to wandb and got the following response:

It is preferred to either pass your config parameters all at once to: wandb.init(config=config_dict_that_could_have_params_set_by_sweep)
or:
experiment = wandb.init()
experiment.config.setdefaults(config_dict_that_could_have_params_set_by_sweep)

The advantage of doing this is that it will ignore setting any key that has already been set by the sweep.

We will look into the torch lightning integration and see if we can make this safer for those using sweeps.

@amoudgl
Copy link
Contributor

amoudgl commented Mar 30, 2020

cc: @neggert, @Borda, @williamFalcon

@Borda
Copy link
Member

Borda commented Mar 30, 2020

@borisdayma @calclavia pls ^^

@borisdayma
Copy link
Contributor

The problem is that it tries to log this value twice and is probably called before automatically by pytorch-lightning.
The callback will automatically log every parameter which is in pl.LightningModule.params (where you probably already have the dropout).

See an example of using pytorch-lightning with wandb (including sweeps) here: https://github.com/borisdayma/lightning-kitti

I'll be adding it to the pytorch-lightning repo later but still need to push a PR related to the watch method for it to work properly.

@Borda
Copy link
Member

Borda commented Apr 16, 2020

@borisdayma is it fixed now?

borisdayma added a commit to borisdayma/pytorch-lightning that referenced this issue Apr 16, 2020
overwrite run config parameters due to precision error

fix Lightning-AI#1290
@borisdayma
Copy link
Contributor

I added a fix.
@AmitMY @amoudgl Feel free to test it with your sweeps and let me know if there's still an error.

williamFalcon added a commit that referenced this issue Apr 24, 2020
* fix(wandb): allow use of sweeps

overwrite run config parameters due to precision error

fix #1290

* docs(wandb): update changelog

* test(wandb): update config test

Co-authored-by: William Falcon <waf2107@columbia.edu>
@Borda Borda added the logger Related to the Loggers label Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on logger Related to the Loggers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants