Class wandb.Settings
Settings for the W&B SDK. This class manages configuration settings for the W&B SDK, ensuring type safety and validation of all settings. Settings are accessible as attributes and can be initialized programmatically, through environment variables (WANDB_ prefix), and with configuration files.
The settings are organized into three categories:
- Public settings: Core configuration options that users can safely modify to customize W&B’s behavior for their specific needs.
- Internal settings: Settings prefixed with ‘x_’ that handle low-level SDK behavior. These settings are primarily for internal use and debugging. While they can be modified, they are not considered part of the public API and may change without notice in future versions.
- Computed settings: Read-only settings that are automatically derived from other settings or the environment.
- Default values defined on this
Settingsmodel. - Configuration files (
~/.config/wandb/settings, or thesettingsfile in the directory named by theWANDB_CONFIG_DIRenvironment variable). - Environment variables (those prefixed with
WANDB_, e.g.WANDB_MODE). - Values detected from the runtime environment, such as the hostname, the running program/script path, the Python executable, the Docker image, and Jupyter notebook details.
- SageMaker settings, when running in an Amazon SageMaker environment.
- The
settingsparameter ofwandb.setup(). - The
settingsparameter ofwandb.init(). - Certain
wandb.init()parameters (for example,mode=overrides themodesetting).
Args
Whether to symlink media files to the run directory.If true, media files will be symlinked or hardlinked to the
run directory instead of copied. This may result in faster
logging and reduced disk usage. However, deleting or modifying
the original files before upload to the W&B server will be
reflected in the uploaded data.
Flag to allow table artifacts to be synced in offline mode.To revert to the old behavior, set this to False.
Mapping of Azure account URLs to their corresponding access keys for Azure integration.
Override for the ‘app’ URL for the W&B UI.The
app_url is normally computed based on base_url, but this can be
used to set it explicitly.WANDB_APP_URL is the corresponding environment variable.Paths to files to load configuration from into the
Config object.The type of console capture to be applied.Possible values are:
- “auto” - Automatically selects the console capture method based on the system environment and settings.
- “off” - Disables console capture.
- “redirect” - Redirects low-level file descriptors for capturing output.
- “wrap” - Overrides the write methods of sys.stdout/sys.stderr. Will be mapped to either “wrap_raw” or “wrap_emu” based on the state of the system.
- “wrap_raw” - Same as “wrap” but captures raw output directly instead of
through an emulator. Derived from the
wrapsetting and should not be set manually. - “wrap_emu” - Same as “wrap” but captures output through an emulator.
Derived from the
wrapsetting and should not be set manually.
Enable multipart console logging.When True, the SDK writes console output to timestamped files
under the
logs/ directory instead of a single output.log.Each part is uploaded as soon as it is closed, giving users live
access to logs while the run is active. Rollover cadence is
controlled by console_chunk_max_bytes and/or console_chunk_max_seconds.
If both limits are 0, all logs are uploaded once at run finish.Note: Uploaded chunks are immutable; terminal control sequences
that modify previous lines (e.g., progress bars using carriage returns)
only affect the current chunk.Size-based rollover threshold for multipart console logs, in bytes.Starts a new console log file when the current part reaches this
size. Has an effect only when
console_multipart is True.
Can be combined with console_chunk_max_seconds; whichever limit is
hit first triggers the rollover. A value of 0 disables the
size-based limit.Time-based rollover threshold for multipart console logs, in seconds.Starts a new console log file after this many seconds have elapsed
since the current part began. Requires
console_multipart to be
True. May be used with console_chunk_max_bytes; the first limit
reached closes the part. A value of 0 disables the time-based
limit.Names of Python loggers to capture into the run’s Logs tab.A mapping of logger name to minimum log level. When set, wandb installs a
logging.Handler on each named logger and removes it when the run finishes.
Log records emitted by those loggers are published as console output to the
run, similar to stdout/stderr capture.Log records are formatted the same as
logging.basicConfig(), like
INFO:my_module:Some message. This is not currently customizable.To capture all logs, pass the name of the root logger, which is ‘root’.This is independent of the console setting: both can be active
simultaneously.Example:Whether to disable inferring fork point from remote branchesWhen set to True, the SDK will use the latest commit from the upstream
branch, if one is set. Otherwise skip generating the diff patch.When set to False, the SDK will try to use the latest commit from the upstream branch,
if one is set.
Otherwise, it will find the closest commit from all remote branches.
This may impact performance for repos with many upstream branches.
Specifies a point in a previous execution of a run to fork from.The point is defined by the run ID, a metric, and its value.
Currently, only the metric ‘_step’ is supported.
Time in seconds to wait for data to upload at the end of a run.Setting this can limit costs caused by slow uploads to W&B at the end of a
run, with the trade-off that the run will be marked crashed and may be
missing some data. The default is for
run.finish() to block until all
data finishes uploading.If this is set to a number greater than zero, W&B gives up on uploading a
run’s data after this many seconds at the end of a run, unblocking your
script. After some time, the run becomes Crashed or Failed in the UI. Any
unuploaded data is still stored on disk and can be uploaded with wandb sync.Use the finish_timeout_raises setting to raise an error in addition to
printing a warning message.Runs shut down by wandb.teardown() (which automatically runs at the end
of a script in an atexit hook) will also respect this setting.Whether to raise a TimeoutError if finish_timeout expires.Using this together with the
finish_timeout setting causes run.finish()
to raise a TimeoutError after a timeout in addition to printing a message.Note that run.finish() is called implicitly when using a Run as a context
manager:with wandb.init() as run:
… # run.finish() executes at the end of the with blockThis does not cause wandb.teardown() to raise an error (since it runs
at the end of a script anyway).The absolute path from the root repository directory to the script that
created the run.Root repository directory is defined as the directory containing the
.git directory, if it exists. Otherwise, it’s the current working directory.
What to do when
wandb.init() is called while a run is active.Options:- “default”: Use “finish_previous” in notebooks and “return_previous” otherwise.
- “return_previous”: Return the most recently created run
that is not yet finished. This does not update
wandb.run; see the “create_new” option. - “finish_previous”: Finish all active runs, then return a new run.
- “create_new”: Create a new run without modifying other active runs.
Does not update
wandb.runand top-level functions likewandb.log. Because of this, some older integrations that rely on the global run will not work.
Specifies the resume behavior for the run.Options:
- “must”: Resumes from an existing run with the same ID. If no such run exists, it will result in failure.
- “allow”: Attempts to resume from an existing run with the same ID. If none is found, a new run will be created.
- “never”: Always starts a new run. If a run with the same ID already exists, it will result in failure.
- “auto”: Automatically resumes from the most recent failed run on the same machine.
Specifies a point in a previous execution of a run to resume from.The point is defined by the run ID, a metric, and its value.
Currently, only the metric ‘_step’ is supported.
The root directory to use as the base for all run-related paths.In particular, this is used to derive the wandb directory and the run directory.
A callback to execute to stop the run.A run can be stopped through the web UI, or after a fatal error
(if configured via a setting).By default, to stop a run, W&B sends a SIGINT to the main thread.
Set this callback to override this behavior, like to use a different
signal or to take some other action before interrupting.The callback runs in a separate thread. It runs soon after a stop is
requested, but not immediately.
Whether to stop the run after a fatal error.After W&B hits an unrecoverable error while uploading data, it prints
a message and stops uploading, but still allows logging more data.
This is usually desirable: your training metrics get stored on disk
and can be recovered using
wandb sync, even if they aren’t uploaded.This is not useful if your files get deleted after training.
In that case, setting this to True will stop the run after a fatal error,
as if the stop button was pressed in the web UI.Whether to use a hidden
.wandb or visible wandb directory for run data.If True, the SDK uses .wandb. If False, wandb.
If not set, defaults to .wandb if it already exists, otherwise wandb.Label to assign to system metrics and console logs collected for the run.This is used to group data by on the frontend and can be used to distinguish data
from different processes in a distributed training job.
Determines whether to save internal wandb files and metadata.In a distributed setting, this is useful for avoiding file overwrites
from secondary processes when only system metrics and logs are needed,
as the primary process handles the main logging.
Flag to delegate automatic computation of summary from history to the server.This does not disable user-provided summary updates.
Whether to skip saving the run events to the transaction log.This is only relevant for online runs. Can be used to reduce the amount of
data written to disk.Should be used with caution, as it removes the gurantees about
recoverability.
Filter to apply to metrics collected from OpenMetrics
/metrics endpoints.Supports two formats:{"metric regex pattern, including endpoint name as prefix": {"label": "label value regex pattern"}}("metric regex pattern 1", "metric regex pattern 2", ...)
GPU device indices to monitor.If not set, the system monitor captures metrics for all GPUs.
Assumes 0-based indexing matching CUDA/ROCm device enumeration.
Monitor the entire process tree for resource usage, starting from
x_stats_pid.When True, the system monitor aggregates the RSS, CPU%, and thread count
from the process with PID x_stats_pid and all of its descendants.
This can have a performance overhead and is disabled by default.Report the CPU and memory used by W&B’s own processes.Adds the
wandb.cpu and wandb.memory.rssMB system metrics. On by default
in development and release-candidate versions, off in releases.Suffix to add to the run’s directory name (sync_dir).This is set in wandb.init() to avoid naming conflicts.
If set, it is joined to the default name with a dash.
Flag to indicate whether this process can update the run’s final state on the server.Set to False in distributed training when only the main process should determine the final state.
Properties
The URL for the W&B UI, usually https://forge.coreweave.com/wandb.This is different from
base_url (like https://api.forge.coreweave.com)
which is used to access W&B APIs programmatically.