Weights and Biases#

The Weights and Biases (WandB) integration automatically sets the relevant environment variables that WandB relies on in the run execution environment.

WandB Logger must be configured in Composer

This integration only sets up the environment, the logger itself must still be configured in Composer. See Composer’s Logging and WandBLogger.

Note that the run name for the WandB run will default to the name of the MCLI run, unless another name is passed into Composer’s WandBLogger, in which case that will take precedence.

First Time Setup: WandB API Key#

This integration requires providing your WandB API key. Generate a WandB API Key at this link, then create an environment variable secret:

mcli create secret env WANDB_API_KEY=<YOUR WANDB API KEY>

This command creates a secret which will mount your API key in the run execution environment as the variable WANDB_API_KEY. For more details on how this works, see the Environment Secrets Page.

Using Weights and Biases in a Run#

To use WandB experimenting tracking in a run, include the WandB integration in the YAML:

integrations:
  - integration_type: wandb

    # The Weights and Biases project name
    project: my_project

    # The username or organization the Weights and Biases project belongs to
    entity: mosaic-ml

Required parameters include: project, entity:

  • project (str): The WandB project name

  • entity (str): An entity is a username or team name where you’re logging runs. This entity must exist before you can use it, so make sure it is configured first in the WandB UI

Optional Parameters#

Optional parameters of the Weights and Biases Integration are used to configure the Weights and Biases logger.

Optional parameters include: group, job_type, tags:

  • group (str): The group the run belongs to. For more information on grouping runs see the Weights and Biases docs. Default: None.

  • job_type (str): The Weights and Biases job type. This is useful when you’re grouping runs together into larger experiments using groups (e.g. “train”, “eval”). Default: None.

  • tags (List[str]): A list of tags for the run. Tags are useful for organizing runs together (e.g. “baseline”, “production”). Default: [].

Example#

integrations:
  - integration_type: wandb

    # The Weights and Biases project name
    project: my_project

    # The organization the Weights and Biases user belongs to
    entity: mosaic-ml

    # Make the run a member of this run group
    group: my_sweep

    # A job type to tag the run with
    job_type: train

    # Tags for the run
    tags:
      - first_tag
      - second_tag