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

feat(wandb): let wandb cli handle runs #4648

Merged
merged 23 commits into from
Nov 23, 2020

Conversation

borisdayma
Copy link
Contributor

@borisdayma borisdayma commented Nov 13, 2020

What does this PR do?

With the release of wandb version >.0.10, the logic for reinit should be handled directly by wandb instead of forcing it to be True in the logger. This allows better handling of runs in jupyter/colab.

In addition, a new run should not be created if it is already existing as it creates unexpected behavior (automatically closing a run manually launched or run by a sweep).

If a user needs to create multiple runs in the same script, he can now just call wandb.finish() at any moment (which was not available previously).

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes? N/A
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In in short, see following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@borisdayma borisdayma changed the title feat(wandb): allow runs to be initialized manually feat(wandb): let wandb cli handle runs Nov 13, 2020
@borisdayma
Copy link
Contributor Author

This should not change how the callback is used.
Not sure if I'm supposed to update the CHANGELOG in this case.

@pep8speaks
Copy link

pep8speaks commented Nov 13, 2020

Hello @borisdayma! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-11-23 18:46:05 UTC

pytorch_lightning/loggers/wandb.py Outdated Show resolved Hide resolved
pytorch_lightning/loggers/wandb.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 13, 2020

Codecov Report

Merging #4648 (6b08489) into master (404af43) will increase coverage by 0%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #4648    +/-   ##
=======================================
  Coverage      93%     93%            
=======================================
  Files         118     118            
  Lines        8910    9020   +110     
=======================================
+ Hits         8284    8393   +109     
- Misses        626     627     +1     

@@ -126,7 +128,7 @@ def experiment(self) -> Run:
os.environ['WANDB_MODE'] = 'dryrun'
self._experiment = wandb.init(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we handle legacy there ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. The new wandb CLI appeared in v0.10.0 (9/11/2020). However the reinit logic has actually changed for several months (though it's probably the most robust in the latest versions).

Using the latest version of wandb should not be a breaking change since reinit was forced to True and now it will automatically do what should be expected (ie start a run only when none is existing). Also it's now directly accessible through environment variables if users needed to set it to True for some reasons.

@borisdayma
Copy link
Contributor Author

I added a test to check wandb.init was called only when required

@Borda Borda requested a review from tchaton November 16, 2020 17:37
@Borda Borda added bug Something isn't working logger Related to the Loggers labels Nov 16, 2020
@Borda Borda added this to the 1.0.x milestone Nov 16, 2020
@Borda Borda added the feature Is an improvement or enhancement label Nov 16, 2020
@Borda Borda modified the milestones: 1.0.x, 1.1 Nov 18, 2020
CHANGELOG.md Outdated Show resolved Hide resolved
@Borda Borda modified the milestones: 1.1, 1.0.x Nov 18, 2020
@Borda Borda added the ready PRs ready to be merged label Nov 18, 2020
@awaelchli awaelchli removed the ready PRs ready to be merged label Nov 23, 2020
@borisdayma
Copy link
Contributor Author

Hi guys, just checking if you need anything else from me

@awaelchli
Copy link
Contributor

@borisdayma I'm currently checking why tests are failing, that's why I removed the ready label.

@awaelchli
Copy link
Contributor

awaelchli commented Nov 23, 2020

good catch @rohitgr7 thanks!!

@awaelchli awaelchli added the ready PRs ready to be merged label Nov 23, 2020
@rohitgr7 rohitgr7 merged commit c586e5d into Lightning-AI:master Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Related to a 3rd-party bug Something isn't working feature Is an improvement or enhancement logger Related to the Loggers ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants