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

Fix WandbLogger.watch() method annotation to accept None for the log parameter #19237

Merged
merged 3 commits into from
Jan 9, 2024

Conversation

daturkel
Copy link
Contributor

@daturkel daturkel commented Jan 5, 2024

This is a comically small change that fixed an annoyance I was having. The wandb watch method has a log argument which can be a string ("gradients", "parameters", "all") OR None. You might provide None if you want to call watch with log_graph but don't want to log the gradients or parameters.

However, the WandBLogger watch method has a type annotation of str for the log parameter which is passed to the underlying wandb.watch log parameter. This PR simply changes that type annotation to Optional[str] so that None doesn't violate the type annotation.

The current WandBLogger docs are kind of more "tutorial style" rather than a full reference of all the methods on the class, so there isn't necessarily a change that needs to be made. However, I'm open to suggestions.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • 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?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

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

Reviewer checklist
  • 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

📚 Documentation preview 📚: https://pytorch-lightning--19237.org.readthedocs.build/en/19237/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jan 5, 2024
@awaelchli awaelchli added code quality community This PR is from the community labels Jan 7, 2024
@awaelchli awaelchli modified the milestones: 2.2, 2.1.x Jan 7, 2024
@awaelchli awaelchli added the logger: wandb Weights & Biases label Jan 7, 2024
@awaelchli awaelchli changed the title wandblogger watch method annotation should accept null log parameter Fix WandbLogger.watch() method annotation to accept None for the log parameter Jan 7, 2024
Copy link

codecov bot commented Jan 7, 2024

Codecov Report

Merging #19237 (53920c0) into master (ae1f78c) will decrease coverage by 34%.
The diff coverage is 100%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19237      +/-   ##
==========================================
- Coverage      83%      49%     -34%     
==========================================
  Files         445      437       -8     
  Lines       37301    37148     -153     
==========================================
- Hits        30990    18238   -12752     
- Misses       6311    18910   +12599     

@mergify mergify bot added the ready PRs ready to be merged label Jan 8, 2024
@daturkel
Copy link
Contributor Author

daturkel commented Jan 9, 2024

Thanks for the approvals!

@awaelchli awaelchli merged commit baeef93 into Lightning-AI:master Jan 9, 2024
92 checks passed
awaelchli pushed a commit that referenced this pull request Jan 30, 2024
lexierule pushed a commit that referenced this pull request Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality community This PR is from the community logger: wandb Weights & Biases pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants