-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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] Use wandb Run as a context manager #49307
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing this! Is there any W&B documentation that describes the best practices for this? Would love to brush up on this information and make sure we're applying the best practices everywhere we mention W&B (e.g. the documentation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly embarrassingly, I think our docs don't do a great job of mentioning this particular recommendation. I'm working on fixing that with our documentation team, after which https://docs.wandb.ai/guides/track/launch/ and especially https://docs.wandb.ai/guides/integrations/add-wandb-to-any-library would mention proper run.finish()
or run-as-a-context-manager usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a while, but it's in the works :) wandb/docs#1146
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
|
Friendly ping! Is merging this PR my responsibility or the repo owners'? I do not appear to have the ability to initiate a merge. |
Signed-off-by: Timofey Peshin <[email protected]>
Head branch was pushed to by a user without write access
After the tests pass, we can merge it :) |
Aha, I didn't realize I could see the tests. I see some failures that look relevant; I'll try to investigate soon. |
Is there a good reason to use the I could update the mock, but I think the tests would be better if they used Also, I'm having trouble getting the tests to run locally: I rebased to master, installed test requirements as in https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#testing and followed the instructions at https://docs.ray.io/en/latest/ray-contribute/development.html#building-ray-python-only, but I get the following error
Any advice? |
Why are these changes needed?
This fixes two problems:
wandb.finish()
function is discouraged as it relies on there being exactly one run in the current Python interpreter. Instead, thefinish()
method of the desired Run object should be called directly.I found this implementation while helping debug an issue for a user who's using this integration together with PyTorch Lightning's W&B integration. I don't think this PR fixes a bug, but the original code is risky and doesn't follow our recommendations.
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.