Skip to content
Software capabilities
Weights & Biases

How to download a Weights & Biases artifact version

Use wandb artifact get for a terminal download or the Python Public API to select the artifact version and download its files.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. SDK: wandb.Api().artifact().download()
  2. CLI: wandb artifact get
SDK

wandb.Api().artifact().download()

Fetch a specific artifact version using an entity, project, artifact name, and version. Download its files without starting a W&B Run.

Read source: W&B download and use an artifact
Requirements
The wandb Python package, authenticated W&B credentials, and read access to the artifact's project.
Limitations
download() writes files locally. Use path_prefix to download only a named file or subdirectory when eligible.

Example text

import os
import wandb

artifact = wandb.Api().artifact(os.environ["WANDB_ARTIFACT_REF"])
artifact.download(root="./artifact-preview")
CLI

wandb artifact get

Download an artifact by reference into a local directory.

Read source: W&B artifact get CLI reference
Requirements
The wandb CLI, authenticated W&B credentials, and read access to the artifact's project.
Limitations
Use an explicit version such as v0 for a reproducible download. --root sets the local destination.

Example shell

wandb artifact get "$WANDB_ARTIFACT_REF" --root ./artifact-preview