Tutorial: Create sweep job from project
This tutorial explains how to create sweep jobs from a pre-existing W&B project. We will use the Fashion MNIST dataset to train a PyTorch convolutional neural network how to classify images. The required code an dataset is located in the W&B repo: https://github.com/wandb/examples/tree/master/examples/pytorch/pytorch-cnn-fashion
Explore the results in this W&B Dashboard.
1. Create a project
First, create a baseline. Download the PyTorch MNIST dataset example model from W&B examples GitHub repository. Next, train the model. The training script is within the examples/pytorch/pytorch-cnn-fashion
directory.
- Clone this repo
git clone https://github.com/wandb/examples.git
- Open this example
cd examples/pytorch/pytorch-cnn-fashion
- Run a run manually
python train.py
Optionally explore the example appear in the W&B App UI dashboard.
View an example project page →
2. Create a sweep
From your project page, open the Sweep tab in the sidebar and select Create Sweep.
The auto-generated configuration guesses values to sweep over based on the runs you have completed. Edit the configuration to specify what ranges of hyperparameters you want to try. When you launch the sweep, it starts a new process on the hosted W&B sweep server. This centralized service coordinates the agents— the machines that are running the training jobs.
3. Launch agents
Next, launch an agent locally. You can launch up to 20 agents on different machines in parallel if you want to distribute the work and finish the sweep job more quickly. The agent will print out the set of parameters it’s trying next.
Now you're running a sweep. The following image demonstrates what the dashboard looks like as the example sweep job is running. View an example project page →
Seed a new sweep with existing runs
Launch a new sweep using existing runs that you've previously logged.
- Open your project table.
- Select the runs you want to use with checkboxes on the left side of the table.
- Click the dropdown to create a new sweep.
Your sweep will now be set up on our server. All you need to do is launch one or more agents to start running runs.
If you kick off the new sweep as a bayesian sweep, the selected runs will also seed the Gaussian Process.