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

Is there a way to turn off Weights and Biases without code changes? #764

Closed
mathemakitten opened this issue Jan 14, 2020 · 21 comments
Closed
Labels
ty:question type of issue is a question

Comments

@mathemakitten
Copy link

  • Weights and Biases version: 0.8.19
  • Python version: 3.7
  • Operating System: Linux

Is there a way to totally turn off W&B without having to build if-logic? I know I can do WANDB_MODE="dryrun" but I want to turn it completely off (i.e. ignore Wandb.init(), ignore wand.save, don't even write files).

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.78. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the ty:question type of issue is a question label Jan 14, 2020
@mathemakitten
Copy link
Author

mathemakitten commented Jan 14, 2020

Also, is there a way to turn off W&B warnings? I'm running in dryrun mode as a workaround but still getting wandb warnings; ideally I'd like to ignore them all. (Best case scenario would be to fully turn off wandb.)

@vanpelt
Copy link
Contributor

vanpelt commented Jan 14, 2020

Hey @mathemakitten currently you can't completely turn off wandb.init but it's a feature we should add. You can turn off all messages from wandb by setting WANDB_SILENT=true

@jarednielsen
Copy link

jarednielsen commented Jun 5, 2020

@vanpelt Is there a timeline for adding this feature? I have a use case where wandb is cluttering up my filesystem even if WANDB_SILENT=true; I would like an environment variable that makes wandb act as a no-op. If there's no way to fully disable it, then I'm wary of adding wandb to my code.

@raubitsj
Copy link
Member

raubitsj commented Jun 6, 2020

@jarednielsen : This is a feature of a new experimental client library:
https://github.com/wandb/client-ng

We are working out the timeline for getting these changes into the released library. But starting next week we will have a noop mode.

The trick to the noop mode is that all the wandb methods and objects have to behave sanely so that your code execution still works like:
run = wandb.init()
run.config.value = 3
print(run.config["value"])

When the experimental client has validated and documented how to use this feature we will comment here and mark this issue with the label "c:cling-flixed". when it is released in the main library this issue will be marked closed

@JDE65
Copy link

JDE65 commented Oct 17, 2020

Hey @mathemakitten currently you can't completely turn off wandb.init but it's a feature we should add. You can turn off all messages from wandb by setting WANDB_SILENT=true

I tried both directly and with os.environ... it doesn't work :-(
Is there no other way ?
THX

@vanpelt
Copy link
Contributor

vanpelt commented Oct 17, 2020

We just released wandb 0.10.7 which has support for the WANDB_SILENT environment variable. You can set it in code before calling wandb.init with os.environ['WANDB_SILENT']="true".

@JDE65
Copy link

JDE65 commented Oct 17, 2020

Great, I'll immediately update it :-)

@JDE65
Copy link

JDE65 commented Oct 19, 2020

I tried and I stll get all warnings and unuseful messages :-(

And I run the same code several times in a row, I also get trouble with the conflict between init and login

@vanpelt
Copy link
Contributor

vanpelt commented Oct 20, 2020

Can you share a few examples of message you're seeing? WANDB_SILENT should disable any lines beginning with **wandb: **. You need to set this env variable before any calls to wandb api's in your script.

@glenn-jocher
Copy link

glenn-jocher commented Nov 12, 2020

I'm going to +1 this thread. I think wandb off should do what it says, and shut it off completely. My current workaround is pip uninstall wandb when I want to be sure it's not logging, since I'm confused by the variety of other options, none of which seem to simply turn it off easily.

I think this is applicable to a variety of situations, i.e. debugging small issues that may cause you to run short trainings dozens of times in a day that you don't want logged anywhere, but then easily turn it on afterward, ideally with $ wandb on.

@vanpelt
Copy link
Contributor

vanpelt commented Nov 12, 2020

Hey @glenn-jocher we're going to address this in the next release hopefully tomorrow. We're deprecating wandb on and wandb off, there will now be 4 commands:

  • wandb online, WANDB_MODE=online or wandb.init(mode="online") - runs in online mode, the default
  • wandb offline, WANDB_MODE=offline or wandb.init(mode="offline") - runs in offline mode, writes all data to disk for later syncing to a server
  • wandb disabled, WANDB_MODE=disabled or wandb.init(mode="disabled") - makes all calls to wandb api's noop's, while maintaining core functionality such as wandb.config and wandb.summary in case you have logic that reads from these dicts.
  • wandb enabled - sets the mode to back online

@glenn-jocher
Copy link

@vanpelt ah that sounds like a good improvement, I think this will help a lot!

@drozzy
Copy link

drozzy commented Nov 18, 2020

Yes, this was rally a pita for me for one-off tweaks/experiments, so I wrote my own if-else statements around wandb code.
The mode="disabled" would be awesome!

@glenn-jocher
Copy link

Can confirm this is working better now.

wandb enabled and wandb disabled seem to behave well and as expected with YOLOv5 :)

@vanpelt
Copy link
Contributor

vanpelt commented Nov 18, 2020

Awesome! We just deployed this feature with wandb==0.10.11, anyone finding this can upgrade with pip install wandb --upgrade. This version now supports the wandb enabled and wandb disabled CLI commands as well as passing mode="disabled" or mode="enabled" to wandb.init. (You can also just set the WANDB_MODE environment variable)

@tom-andersson
Copy link

@vanpelt If running a sweep, does mode in wandb.init() do anything? In my case I have mode='disabled' by default (controlled by a command line input to my train script), and I'm wondering if that will affect my sweeps.

@raubitsj
Copy link
Member

raubitsj commented Jul 20, 2021

@tom-andersson disabled mode is not compatible with sweeps as we need to know what configurations have run. The wandb.init() call is what signals our hyperparameter algorithm that a parameter set was received by an agent.

@tom-andersson
Copy link

Thank you @raubitsj, I've since edited my sweep.yaml to pass in the --wandb command to my train script which triggers mode='online' in wandb.init():

command:      
  - ${env}    
  - python3   
  - ${program}
  - "--wandb" 
  - ${args}   

I'm was previously getting no information sent to the web app when running sweeps, but now everything's running nicely!

@WilliamAshbee
Copy link

WANDB_MODE=offline
seems to make output go to stderr

@glenn-jocher
Copy link

pip uninstall wandb or wandb disabled

ganghe74 added a commit to boostcampaitech4lv23cv2/level2_dataannotation_cv-level2-cv-11 that referenced this issue Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ty:question type of issue is a question
Projects
None yet
Development

No branches or pull requests

9 participants