When you're running a script in an automated environment, you can control wandb with environment variables set before the script runs or within the script.
# This is secret and shouldn't be checked into version controlWANDB_API_KEY=$YOUR_API_KEY# Name and notes optionalWANDB_NAME="My first run"WANDB_NOTES="Smaller learning rate, more regularization."
# Only needed if you don't checkin the wandb/settings fileWANDB_ENTITY=$usernameWANDB_PROJECT=$project
# If you don't want your script to sync to the cloudos.environ['WANDB_MODE'] = 'dryrun'
Use these optional environment variables to do things like set up authentication on remote machines.
Sets the authentication key associated with your account. You can find your key on your settings page. This must be set if
If you're using wandb/local you should set this environment variable to
The human-readable name of your run. If not set it will be randomly generated for you
Longer notes about your run. Markdown is allowed and you can edit this later in the UI.
The entity associated with your run. If you have run
The username of a member of your team associated with the run. This can be used along with a service account API key to enable attribution of automated runs to members of your team.
The project associated with your run. This can also be set with
By default this is set to run which saves results to wandb. If you just want to save your run metadata locally, you can set this to dryrun.
A comma separated list of tags to be applied to the run.
Set this to an absolute path to store all generated files here instead of the wandb directory relative to your training script. be sure this directory exists and the user your process runs as can write to it
By default this is set to never. If set to auto wandb will automatically resume failed runs. If set to must forces the run to exist on startup. If you want to always generate your own unique ids, set this to allow and always set WANDB_RUN_ID.
Set this to a globally unique string (per project) corresponding to a single run of your script. It must be no longer than 64 characters. All non-word characters will be converted to dashes. This can be used to resume an existing run in cases of failure.
Set this to a comma separated list of file globs to ignore. These files will not be synced to the cloud.
Set this to false to prevent wandb from logging fatal errors to its error tracking system.
Set this to true to automatically open a browser with the run url if your operating system supports it.
Set this to a docker image digest to enable restoring of runs. This is set automatically with the wandb docker command. You can obtain an image digest by running
Set this to true to prevent wandb from storing a reference to your source code
Set this to "allow", "never", or "must" to let users create anonymous runs with secret urls.
Comma separated list of yaml files to load into wandb.config. See config.
This defaults to ~/.config/wandb, you can override this location with this environment variable
If you're running in jupyter you can set the name of the notebook with this variable. We attempt to auto detect this.
Set this to the hostname you want to see in the wandb interface if you don't want to use the system provided hostname
Set this to true to silence wandb log statements. If this is set all logs will be written to WANDB_DIR/debug.log
Specify the experiment name to automatically group runs together. See grouping for more info.
Specify the job type, like "training" or "evaluation" to indicate different types of runs. See grouping for more info.
If you're running batch jobs in AWS, it's easy to authenticate your machines with your W&B credentials. Get your API key from your settings page, and set the WANDB_API_KEY environment variable in the AWS batch job spec.
Arguments passed to
wandb.init take precedence over the environment. You could call
wandb.init(dir=os.getenv("WANDB_DIR", my_default_override)) if you want to have a default other than the system default when the environment variable isn't set.
wandb off sets an environmental variable so it turns off all syncing for that session
You can set WANDB_MODE = dryrun to turn off logging. To prevent any log messages:
pythonimport logginglogger = logging.getLogger("wandb")logger.setLevel(logging.WARNING)
Correct, only for python processes that are in the same environment as run.sh.