Settings

class 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:

  1. Public settings: Core configuration options that users can safely modify to customize W&B’s behavior for their specific needs.
  2. 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.
  3. Computed settings: Read-only settings that are automatically derived from other settings or the environment.

method Settings.__init__

__init__(
    allow_offline_artifacts: 'bool' = True,
    allow_val_change: 'bool' = False,
    anonymous: 'Literal['must', 'allow', 'never'] | None' = None,
    api_key: 'str | None' = None,
    azure_account_url_to_access_key: 'dict[str, str] | None' = None,
    base_url: 'str' = 'https://api.wandb.ai',
    code_dir: 'str | None' = None,
    config_paths: 'Sequence | None' = None,
    console: 'Literal['auto', 'off', 'wrap', 'redirect', 'wrap_raw', 'wrap_emu']' = 'auto',
    console_multipart: 'bool' = False,
    credentials_file: 'str' = None,
    disable_code: 'bool' = False,
    disable_git: 'bool' = False,
    disable_job_creation: 'bool' = True,
    docker: 'str | None' = None,
    email: 'str | None' = None,
    entity: 'str | None' = None,
    organization: 'str | None' = None,
    force: 'bool' = False,
    fork_from: 'RunMoment | None' = None,
    git_commit: 'str | None' = None,
    git_remote: 'str' = 'origin',
    git_remote_url: 'str | None' = None,
    git_root: 'str | None' = None,
    heartbeat_seconds: 'int' = 30,
    host: 'str | None' = None,
    http_proxy: 'str | None' = None,
    https_proxy: 'str | None' = None,
    identity_token_file: 'str | None' = None,
    ignore_globs: 'Sequence' = (),
    init_timeout: 'float' = 90.0,
    insecure_disable_ssl: 'bool' = False,
    job_name: 'str | None' = None,
    job_source: 'Literal['repo', 'artifact', 'image'] | None' = None,
    label_disable: 'bool' = False,
    launch: 'bool' = False,
    launch_config_path: 'str | None' = None,
    login_timeout: 'float | None' = None,
    mode: 'Literal['online', 'offline', 'shared', 'disabled', 'dryrun', 'run']' = 'online',
    notebook_name: 'str | None' = None,
    program: 'str | None' = None,
    program_abspath: 'str | None' = None,
    program_relpath: 'str | None' = None,
    project: 'str | None' = None,
    quiet: 'bool' = False,
    reinit: 'Literal['default', 'return_previous', 'finish_previous', 'create_new'] | bool' = 'default',
    relogin: 'bool' = False,
    resume: 'Literal['allow', 'must', 'never', 'auto'] | None' = None,
    resume_from: 'RunMoment | None' = None,
    resumed: 'bool' = False,
    root_dir: 'str' = None,
    run_group: 'str | None' = None,
    run_id: 'str | None' = None,
    run_job_type: 'str | None' = None,
    run_name: 'str | None' = None,
    run_notes: 'str | None' = None,
    run_tags: 'tuple[str, Ellipsis] | None' = None,
    sagemaker_disable: 'bool' = False,
    save_code: 'bool | None' = None,
    settings_system: 'str | None' = None,
    max_end_of_run_history_metrics: 'int' = 10,
    max_end_of_run_summary_metrics: 'int' = 10,
    show_colors: 'bool | None' = None,
    show_emoji: 'bool | None' = None,
    show_errors: 'bool' = True,
    show_info: 'bool' = True,
    show_warnings: 'bool' = True,
    silent: 'bool' = False,
    start_method: 'str | None' = None,
    strict: 'bool | None' = None,
    summary_timeout: 'int' = 60,
    summary_warnings: 'int' = 5,
    sweep_id: 'str | None' = None,
    sweep_param_path: 'str | None' = None,
    symlink: 'bool' = None,
    sync_tensorboard: 'bool | None' = None,
    table_raise_on_max_row_limit_exceeded: 'bool' = False,
    username: 'str | None' = None,
    x_cli_only_mode: 'bool' = False,
    x_disable_meta: 'bool' = False,
    x_disable_stats: 'bool' = False,
    x_disable_viewer: 'bool' = False,
    x_disable_machine_info: 'bool' = False,
    x_executable: 'str | None' = None,
    x_extra_http_headers: 'dict[str, str] | None' = None,
    x_file_stream_max_bytes: 'int | None' = None,
    x_file_stream_max_line_bytes: 'int | None' = None,
    x_file_stream_transmit_interval: 'float | None' = None,
    x_file_stream_retry_max: 'int | None' = None,
    x_file_stream_retry_wait_min_seconds: 'float | None' = None,
    x_file_stream_retry_wait_max_seconds: 'float | None' = None,
    x_file_stream_timeout_seconds: 'float | None' = None,
    x_file_transfer_retry_max: 'int | None' = None,
    x_file_transfer_retry_wait_min_seconds: 'float | None' = None,
    x_file_transfer_retry_wait_max_seconds: 'float | None' = None,
    x_file_transfer_timeout_seconds: 'float | None' = None,
    x_files_dir: 'str | None' = None,
    x_flow_control_custom: 'bool | None' = None,
    x_flow_control_disabled: 'bool | None' = None,
    x_graphql_retry_max: 'int | None' = None,
    x_graphql_retry_wait_min_seconds: 'float | None' = None,
    x_graphql_retry_wait_max_seconds: 'float | None' = None,
    x_graphql_timeout_seconds: 'float | None' = None,
    x_internal_check_process: 'float' = 8.0,
    x_jupyter_name: 'str | None' = None,
    x_jupyter_path: 'str | None' = None,
    x_jupyter_root: 'str | None' = None,
    x_label: 'str | None' = None,
    x_live_policy_rate_limit: 'int | None' = None,
    x_live_policy_wait_time: 'int | None' = None,
    x_log_level: 'int' = 20,
    x_network_buffer: 'int | None' = None,
    x_primary: 'bool' = True,
    x_proxies: 'dict[str, str] | None' = None,
    x_runqueue_item_id: 'str | None' = None,
    x_save_requirements: 'bool' = True,
    x_server_side_derived_summary: 'bool' = False,
    x_server_side_expand_glob_metrics: 'bool' = True,
    x_service_transport: 'str | None' = None,
    x_service_wait: 'float' = 30.0,
    x_skip_transaction_log: 'bool' = False,
    x_start_time: 'float | None' = None,
    x_stats_pid: 'int' = 16976,
    x_stats_sampling_interval: 'float' = 15.0,
    x_stats_neuron_monitor_config_path: 'str | None' = None,
    x_stats_dcgm_exporter: 'str | None' = None,
    x_stats_open_metrics_endpoints: 'dict[str, str] | None' = None,
    x_stats_open_metrics_filters: 'dict[str, dict[str, str]] | Sequence | None' = None,
    x_stats_open_metrics_http_headers: 'dict[str, str] | None' = None,
    x_stats_disk_paths: 'Sequence | None' = ('/',),
    x_stats_cpu_count: 'int | None' = None,
    x_stats_cpu_logical_count: 'int | None' = None,
    x_stats_gpu_count: 'int | None' = None,
    x_stats_gpu_type: 'str | None' = None,
    x_stats_gpu_device_ids: 'Sequence | None' = None,
    x_stats_buffer_size: 'int' = 0,
    x_stats_coreweave_metadata_base_url: 'str' = 'http://169.254.169.254',
    x_stats_coreweave_metadata_endpoint: 'str' = '/api/v2/cloud-init/meta-data',
    x_stats_track_process_tree: 'bool' = False,
    x_sync: 'bool' = False,
    x_update_finish_state: 'bool' = True
)  None

Args:

  • allow_offline_artifacts (bool): Flag to allow table artifacts to be synced in offline mode. To revert to the old behavior, set this to False.

  • allow_val_change (bool): Flag to allow modification of Config values after they’ve been set.

  • anonymous (Optional[Literal[‘must’, ‘allow’, ’never’]]): Controls anonymous data logging. Possible values are:

    • “never”: requires you to link your W&B account before tracking the run, so you don’t accidentally create an anonymous run.
    • “allow”: lets a logged-in user track runs with their account, but lets someone who is running the script without a W&B account see the charts in the UI.
    • “must”: sends the run to an anonymous account instead of to a signed-up user account.
  • api_key (Optional[str]): The W&B API key.

  • azure_account_url_to_access_key (Optional[Dict[str, str]]): Mapping of Azure account URLs to their corresponding access keys for Azure integration.

  • base_url (str): The URL of the W&B backend for data synchronization.

  • code_dir (Optional[str]): Directory containing the code to be tracked by W&B.

  • config_paths (Optional[Sequence]): Paths to files to load configuration from into the Config object.

  • console (Literal[‘auto’, ‘off’, ‘wrap’, ‘redirect’, ‘wrap_raw’, ‘wrap_emu’]): 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 wrap setting and should not be set manually. “wrap_emu” - Same as “wrap” but captures output through an emulator. Derived from the wrap setting and should not be set manually.

  • console_multipart (bool): Whether to produce multipart console log files.

  • credentials_file (str): Path to file for writing temporary access tokens.

  • disable_code (bool): Whether to disable capturing the code.

  • disable_git (bool): Whether to disable capturing the git state.

  • disable_job_creation (bool): Whether to disable the creation of a job artifact for W&B Launch.

  • docker (Optional[str]): The Docker image used to execute the script.

  • email (Optional[str]): The email address of the user.

  • entity (Optional[str]): The W&B entity, such as a user or a team.

  • organization (Optional[str]): The W&B organization.

  • force (bool): Whether to pass the force flag to wandb.login().

  • fork_from (Optional[RunMoment]): 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.

  • git_commit (Optional[str]): The git commit hash to associate with the run.

  • git_remote (str): The git remote to associate with the run.

  • git_remote_url (Optional[str]): The URL of the git remote repository.

  • git_root (Optional[str]): Root directory of the git repository.

  • host (Optional[str]): Hostname of the machine running the script.

  • http_proxy (Optional[str]): Custom proxy servers for http requests to W&B.

  • https_proxy (Optional[str]): Custom proxy servers for https requests to W&B.

  • identity_token_file (Optional[str]): Path to file containing an identity token (JWT) for authentication.

  • ignore_globs (Sequence): Unix glob patterns relative to files_dir specifying files to exclude from upload.

  • init_timeout (float): Time in seconds to wait for the wandb.init call to complete before timing out.

  • insecure_disable_ssl (bool): Whether to insecurely disable SSL verification.

  • job_name (Optional[str]): Name of the Launch job running the script.

  • job_source (Optional[Literal[‘repo’, ‘artifact’, ‘image’]]): Source type for Launch.

  • label_disable (bool): Whether to disable automatic labeling features.

  • launch_config_path (Optional[str]): Path to the launch configuration file.

  • login_timeout (Optional[float]): Time in seconds to wait for login operations before timing out.

  • mode (Literal[‘online’, ‘offline’, ‘shared’, ‘disabled’, ‘dryrun’, ‘run’]): The operating mode for W&B logging and synchronization.

  • notebook_name (Optional[str]): Name of the notebook if running in a Jupyter-like environment.

  • program (Optional[str]): Path to the script that created the run, if available.

  • program_abspath (Optional[str]): 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.

  • program_relpath (Optional[str]): The relative path to the script that created the run.

  • project (Optional[str]): The W&B project ID.

  • quiet (bool): Flag to suppress non-essential output.

  • reinit (Union[Literal[‘default’, ‘return_previous’, ‘finish_previous’, ‘create_new’], bool]): 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.run and top-level functions like wandb.log. Because of this, some older integrations that rely on the global run will not work. Can also be a boolean, but this is deprecated. False is the same as “return_previous”, and True is the same as “finish_previous”.
  • relogin (bool): Flag to force a new login attempt.

  • resume (Optional[Literal[‘allow’, ‘must’, ’never’, ‘auto’]]): 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.
  • resume_from (Optional[RunMoment]): 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.

  • root_dir (str): 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.

  • run_group (Optional[str]): Group identifier for related runs. Used for grouping runs in the UI.

  • run_id (Optional[str]): The ID of the run.

  • run_job_type (Optional[str]): Type of job being run (e.g., training, evaluation).

  • run_name (Optional[str]): Human-readable name for the run.

  • run_notes (Optional[str]): Additional notes or description for the run.

  • run_tags (Optional[Tuple[str, Ellipsis]]): Tags to associate with the run for organization and filtering.

  • sagemaker_disable (bool): Flag to disable SageMaker-specific functionality.

  • save_code (Optional[bool]): Whether to save the code associated with the run.

  • settings_system (Optional[str]): Path to the system-wide settings file.

  • max_end_of_run_history_metrics (int): Maximum number of history sparklines to display at the end of a run.

  • max_end_of_run_summary_metrics (int): Maximum number of summary metrics to display at the end of a run.

  • show_errors (bool): Whether to display error messages.

  • show_info (bool): Whether to display informational messages.

  • show_warnings (bool): Whether to display warning messages.

  • silent (bool): Flag to suppress all output.

  • strict (Optional[bool]): Whether to enable strict mode for validation and error checking.

  • summary_timeout (int): Time in seconds to wait for summary operations before timing out.

  • sweep_id (Optional[str]): Identifier of the sweep this run belongs to.

  • sweep_param_path (Optional[str]): Path to the sweep parameters configuration.

  • symlink (bool): Whether to use symlinks (True by default except on Windows).

  • sync_tensorboard (Optional[bool]): Whether to synchronize TensorBoard logs with W&B.

  • table_raise_on_max_row_limit_exceeded (bool): Whether to raise an exception when table row limits are exceeded.

  • username (Optional[str]): Username.

  • x_disable_meta (bool): Flag to disable the collection of system metadata.

  • x_disable_stats (bool): Flag to disable the collection of system metrics.

  • x_extra_http_headers (Optional[Dict[str, str]]): Additional headers to add to all outgoing HTTP requests.

  • x_label (Optional[str]): 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.

  • x_primary (bool): 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.

  • x_save_requirements (bool): Flag to save the requirements file.

  • x_server_side_derived_summary (bool): Flag to delegate automatic computation of summary from history to the server. This does not disable user-provided summary updates.

  • x_service_wait (float): Time in seconds to wait for the wandb-core internal service to start.

  • x_skip_transaction_log (bool): 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.

  • x_stats_sampling_interval (float): Sampling interval for the system monitor in seconds.

  • x_stats_dcgm_exporter (Optional[str]): Endpoint to extract Nvidia DCGM metrics from. Options:

    • Extract DCGM-related metrics from a query to the Prometheus /api/v1/query endpoint. It is a common practice to aggregate metrics reported by the instances of the DCGM Exporter running on different nodes in a cluster using Prometheus.
    • TODO: Parse metrics directly from the /metrics endpoint of the DCGM Exporter. Examples:
    • http://localhost:9400/api/v1/query?query=DCGM_FI_DEV_GPU_TEMP{node="l1337", cluster="globular"}.
  • x_stats_open_metrics_endpoints (Optional[Dict[str, str]]): OpenMetrics /metrics endpoints to monitor for system metrics.

  • x_stats_open_metrics_filters (Union[Dict[str, Dict[str, str]], Sequence, None]): 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”, …)
  • x_stats_open_metrics_http_headers (Optional[Dict[str, str]]): HTTP headers to add to OpenMetrics requests.

  • x_stats_disk_paths (Optional[Sequence]): System paths to monitor for disk usage.

  • x_stats_cpu_count (Optional[int]): System CPU count. If set, overrides the auto-detected value in the run metadata.

  • x_stats_cpu_logical_count (Optional[int]): Logical CPU count. If set, overrides the auto-detected value in the run metadata.

  • x_stats_gpu_count (Optional[int]): GPU device count. If set, overrides the auto-detected value in the run metadata.

  • x_stats_gpu_type (Optional[str]): GPU device type. If set, overrides the auto-detected value in the run metadata.

  • x_stats_gpu_device_ids (Optional[Sequence]): 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.

  • x_stats_track_process_tree (bool): 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.

  • x_update_finish_state (bool): 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.

Returns: An Settings object.

classmethod Settings.catch_private_settings

catch_private_settings(
    values
)  None

Check if a private field is provided and assign to the corresponding public one.

This is a compatibility layer to handle previous versions of the settings.

method Settings.validate_skip_transaction_log

validate_skip_transaction_log()  None

classmethod Settings.validate_run_tags

validate_run_tags(
    value
)  None

Validate run tags.

Validates that each tag:

  • Is between 1 and 64 characters in length (inclusive)
  • Converts single string values to tuple format
  • Preserves None values

Args:

  • value: A string, list, tuple, or None representing tags

Returns:

  • tuple: A tuple of validated tags, or None

Raises:

  • ValueError: If any tag is empty or exceeds 64 characters
  • <!-- lazydoc-ignore-classmethod: internal –>

property Settings.colab_url

The URL to the Colab notebook, if running in Colab.

Returns:

  • Optional[str]: The colab_url property value.

property Settings.deployment

property Settings.files_dir

Absolute path to the local directory where the run’s files are stored.

Returns:

  • str: The files_dir property value.

property Settings.is_local

property Settings.log_dir

The directory for storing log files.

Returns:

  • str: The log_dir property value.

property Settings.log_internal

The path to the file to use for internal logs.

Returns:

  • str: The log_internal property value.

The path to the symlink to the internal log file of the most recent run.

Returns:

  • str: The log_symlink_internal property value.

The path to the symlink to the user-process log file of the most recent run.

Returns:

  • str: The log_symlink_user property value.

property Settings.log_user

The path to the file to use for user-process logs.

Returns:

  • str: The log_user property value.

property Settings.project_url

The W&B URL where the project can be viewed.

Returns:

  • str: The project_url property value.

property Settings.resume_fname

The path to the resume file.

Returns:

  • str: The resume_fname property value.

property Settings.run_mode

The mode of the run. Can be either “run” or “offline-run”.

Returns:

  • Literal['run', 'offline-run']: The run_mode property value.

property Settings.run_url

The W&B URL where the run can be viewed.

Returns:

  • str: The run_url property value.

property Settings.settings_workspace

The path to the workspace settings file.

Returns:

  • str: The settings_workspace property value.

property Settings.sweep_url

The W&B URL where the sweep can be viewed.

Returns:

  • str: The sweep_url property value.

property Settings.sync_dir

The directory for storing the run’s files.

Returns:

  • str: The sync_dir property value.

property Settings.sync_file

Path to the append-only binary transaction log file.

Returns:

  • str: The sync_file property value.

Path to the symlink to the most recent run’s transaction log file.

Returns:

  • str: The sync_symlink_latest property value.

property Settings.timespec

The time specification for the run.

Returns:

  • str: The timespec property value.

property Settings.wandb_dir

Full path to the wandb directory.

Returns:

  • str: The wandb_dir property value.

method Settings.update_from_system_config_file

update_from_system_config_file()  None

Update settings from the system config file.

method Settings.update_from_workspace_config_file

update_from_workspace_config_file()  None

Update settings from the workspace config file.

method Settings.update_from_env_vars

update_from_env_vars(
    environ: 'Dict[str, Any]'
)  None

Update settings from environment variables.

method Settings.update_from_system_environment

update_from_system_environment()  None

Update settings from the system environment.

method Settings.update_from_dict

update_from_dict(
    settings: 'Dict[str, Any]'
)  None

Update settings from a dictionary.

method Settings.update_from_settings

update_from_settings(
    settings: 'Settings'
)  None

Update settings from another instance of Settings.

method Settings.to_proto

to_proto()  wandb_settings_pb2.Settings

Generate a protobuf representation of the settings.