Skip to main content

Sweeps on Launch

Create a hyperparameter tuning job (sweeps) with W&B Launch. With sweeps on launch, a sweep scheduler is pushed to a Launch Queue with the specified hyperparameters to sweep over. The sweep scheduler starts as it is picked up by the agent, launching sweep runs onto the same queue with chosen hyperparameters. This continues until the sweep finishes or is stopped.

You can use the default W&B Sweep scheduling engine or implement your own custom scheduler:

  1. Standard sweep scheduler: Use the default W&B Sweep scheduling engine that controls W&B Sweeps. The familiar bayes, grid, and random methods are available.
  2. Custom sweep scheduler: Configure the sweep scheduler to run as a job. This option enables full customization. An example of how to extend the standard sweep scheduler to include more logging can be found in the section below.
note

This guide assumes that W&B Launch has been previously configured. If W&B Launch has is not configured, see the how to get started section of the launch documentation.

tip

We recommend you create a sweep on launch using the 'basic' method if you are a first time users of sweeps on launch. Use a custom sweeps on launch scheduler when the standard W&B scheduling engine does not meet your needs.

Create a sweep with a W&B standard schedulerโ€‹

Create W&B Sweeps with Launch. You can create a sweep interactively with the W&B App or programmatically with the W&B CLI. For advanced configurations of Launch sweeps, including the ability to customize the scheduler, use the CLI.

info

Before you create a sweep with W&B Launch, ensure that you first create a job to sweep over. See the Create a Job page for more information.

Create a sweep interactively with the W&B App.
  1. Navigate to your W&B project on the W&B App.
  2. Select the sweeps icon on the left panel (broom image).
  3. Next, select the Create Sweep button.
  4. Click the Configure Launch ๐Ÿš€ button.
  5. From the Job dropdown menu, select the name of your job and the job version you want to create a sweep from.
  6. Select a queue to run the sweep on using the Queue dropdown menu.
  7. Use the Job Priority dropdown to specify the priority of your launch job. A launch job's priority is set to "Medium" if the launch queue does not support prioritization.
  8. (Optional) Configure override args for the run or sweep scheduler. For example, using the scheduler overrides, configure the number of concurrent runs the scheduler manages using num_workers.
  9. (Optional) Select a project to save the sweep to using the Destination Project dropdown menu.
  10. Click Save
  11. Select Launch Sweep.

Create a custom sweep schedulerโ€‹

Create a custom sweep scheduler either with the W&B scheduler or a custom scheduler.

info

Using scheduler jobs requires wandb cli version >= 0.15.4

Create a launch sweep using the W&B sweep scheduling logic as a job.

  1. Identify the Wandb scheduler job in the public wandb/sweep-jobs project, or use the job name: 'wandb/sweep-jobs/job-wandb-sweep-scheduler:latest'
  2. Construct a configuration yaml with an additional scheduler block that includes a job key pointing to this name, example below.
  3. Use the wandb launch-sweep command with the new config.

Example config:

# launch-sweep-config.yaml  
description: Launch sweep config using a scheduler job
scheduler:
job: wandb/sweep-jobs/job-wandb-sweep-scheduler:latest
num_workers: 8 # allows 8 concurrent sweep runs

# training/tuning job that the sweep runs will execute
job: wandb/sweep-jobs/job-fashion-MNIST-train:latest
method: grid
parameters:
learning_rate:
min: 0.0001
max: 0.1

Examples of what is possible with custom sweep scheduler jobs are available in the wandb/launch-jobs repo under jobs/sweep_schedulers. This guide shows how to use the publicly available Wandb Scheduler Job, as well demonstrates a process for creating custom sweep scheduler jobs.

How to resume sweeps on launchโ€‹

It is also possible to resume a launch-sweep from a previously launched sweep. Although hyperparameters and the training job cannot be changed, scheduler-specific parameters can be, as well as the queue it is pushed to.

info

If the initial sweep used a training job with an alias like 'latest', resuming can lead to different results if the latest job version has been changed since the last run.

  1. Identify the sweep name/ID for a previously run launch sweep. The sweep ID is an eight character string (for example, hhd16935) that you can find in your project on the W&B App.
  2. If you change the scheduler parameters, construct an updated config file.
  3. In your terminal, execute the following command. Replace content wrapped in "<" and ">" with your information:
wandb launch-sweep <optional config.yaml> --resume_id <sweep id> --queue <queue_name>
Was this page helpful?๐Ÿ‘๐Ÿ‘Ž