Skip to main content
This walkthrough demonstrates how to create, track, and use a dataset artifact.

1. Log into Weights & Biases

Import the W&B library and log in to Weights & Biases. You will need to sign up for a free Weights & Biases account if you have not done so already.

2. Initialize a run

Use wandb.init() to initialize a run. This generates a background process to sync and log data. Provide a project name and a job type:

3. Create an artifact object

Create an artifact object with the wandb.Artifact(). Provide a name for the artifact and a description of the file type for the name and type parameters, respectively. For example, the following code snippet demonstrates how to create an artifact called ‘bicycle-dataset’ with a ‘dataset’ label:
For more information about how to construct an artifact, see Construct artifacts.

4. Add the dataset to the artifact

Add a file to the artifact. Common file types include models and datasets. The following example adds a dataset named dataset.h5 that is saved locally on our machine to the artifact:
Replace the filename dataset.h5 in the previous code snippet with the path to the file you want to add to the artifact.

5. Log the dataset

Use the W&B run objects wandb.Run.log_artifact() method to both save your artifact version and declare the artifact as an output of the run.
A 'latest' alias is created by default when you log an artifact. For more information about artifact aliases and versions, see Create a custom alias and Create new artifact versions, respectively. Putting this together, you script so far should look like this:

6. Download and use the artifact

The following code example demonstrates the steps you can take to use an artifact you have logged and saved to the Weights & Biases servers.
  1. First, initialize a new run object with wandb.init().
  2. Second, use the run objects wandb.Run.use_artifact() method to tell Weights & Biases what artifact to use. This returns an artifact object.
  3. Third, use the artifacts wandb.Artifact.download() method to download the contents of the artifact.
Alternatively, you can use the Public API (wandb.Api) to export (or update data) data already saved in Weights & Biases outside of a Run. See Track external files for more information.
Last modified on September 30, 2026