Runs
A single unit of computation logged by W&B is called a run. You can think of a W&B run as an atomic element of your whole project. You should initiate a new run when you:
- Train a model
- Change a hyperparameter
- Use a different model
- Log data or a model as a W&B Artifact
- Download a W&B Artifact
For example, during a sweep, W&B explores a hyperparameter search space that you specify. Each new hyperparameter combination created by the sweep is implemented and recorded as a unique run.
Some key things to consider when you create and manage runs:
- Anything you log with
wandb.log
is recorded in that run. For more information on how log objects in W&B, see Log Media and Objects. - Each run is associated to a specific W&B project.
- View runs and their properties within the run's project workspace on the W&B App UI.
- There is only at most one active
wandb.Run
in any process, and it is accessible aswandb.run
.
Create a runโ
Create a W&B run with wandb.init()
:
import wandb
run = wandb.init()
We recommend you specify a project name and a W&B entity when you create a new run. W&B creates a new project (if the project does not already exist) within the W&B entity you provide. If the project already exists, W&B stores the run in that project.
For example, the following code snippet initializes a run that is stored in a project called model_registry_example
that is scoped within a wandbee
entity:
import wandb
run = wandb.init(entity="wandbee", \
project="model_registry_example")
W&B prints the name of the run that is created along with a URL path to find out more information about that specific run.
For example, the code snippet above produces this output:
Organize runs with run names and run IDsโ
By default, W&B generates a random name and run ID when you initialize a new run.
In the preceding example, W&B generates a run name called likely-lion-9
and a run ID of xlm66ixq
. The likely-lion-9
run is stored in a project called model_registry_example
.
Run names that are generated by W&B are not guaranteed to be unique.
You can provide a unique run ID identifier with the id
parameter and a name for your run with the name
parameter when you initialize a run. For example,
import wandb
run = wandb.init(
entity="<project>",
project="<project>",
name="<run-name>",
id="<run-id>"
)
Use run names and run IDs to quickly find your experiments in your project within the W&B App UI. You can find detailed information about a specific run with the URL:
https://wandb.ai/entity/project-name/run-id
Where:
entity
: The W&B entity that initialized the run.project
: The project where the run is stored.run-id
: The run ID for the run.
W&B suggests that you specify a project name when you initialize a run. If a project is not specified, W&B stores runs in a project called "Uncategorized".
See the wandb.init
reference documentation for a full list of parameters you can use.
View a runโ
View a specific run within the project the run was logged to:
- Navigate to the W&B App UI at https://wandb.ai/home.
- Navigate to the W&B project you specified when you initialized the run.
- Within your project's workspace, you will see a table labeled Runs. This table lists all the runs that are in your project. From the list of runs shown, select the run you want to view.
- Next, select the Overview Tab icon.
The following image demonstrates information about a Run called sparkling-glade-2:
The Overview Tab shows the following information about the run you selected:
- Run name: The name of the run.
- Description: A description of the run that you provided. This field is left initially blank if no description was specified when you create the run. You can optionally provide a description for the run with the W&B App UI or programmatically.
- Privacy: Privacy settings of the run. You can set it to either Private or Public.
- Private: (Default) Only you can view and contribute.
- Public: Anyone can view.
- Tags: (list, optional) A list of strings. Tags are useful for organizing runs together, or applying temporary labels like "baseline" or "production".
- Author: The W&B username that created the run.
- Run state: The state of the run:
- finished: script ended and fully synced data, or called
wandb.finish()
- failed: script ended with a non-zero exit status
- crashed: script stopped sending heartbeats in the internal process, which can happen if the machine crashes
- running: script is still running and has recently sent a heartbeat
- finished: script ended and fully synced data, or called
- Start time: The timestamp when the run started.
- Duration: How long, in seconds, the run took to finish, fail, or crash.
- Run path: The unique run identifier. It has the form of
entity/project/run-ID
- Host name: Where the run was launched. The name of your machine is displayed if you launched the run locally on your machine.
- Operating system: The operating system used for the run.
- Python version: The Python version used for the run.
- Python executable: The command that started the run.
- System Hardware: The hardware used to create the run.
- W&B CLI version: The W&B ClI version installed on the machine that hosted the run command.
- Job Type:
Below the overview section, you will additionally find information about:
- Artifact Outputs: Artifact outputs produced by the run.
- Config: List of config parameters saved with
wandb.config
. - Summary: List of summary parameters saved with
wandb.log()
. By default, this value is set to the last value logged.
For more information about how to organize multiple Runs in a project, see the Runs Table documentation.
For a live example of a Project's Workspace, see this example project.
End a runโ
W&B automatically ends runs and logs data from that run to your W&B project. You can end a run manually with the run.finish
command. For example:
import wandb
run = wandb.init()
run.finish()
W&B suggests that you use the wandb.finish
method at the end of the child process if you call wandb.init
from a child process.