Skip to main content
Download and use an artifact that is already stored on the W&B server or construct an artifact object and pass it in for de-duplication as necessary.
Team members with a Models Viewer seat cannot download artifacts.

Download and use an artifact stored on W&B

Download an artifact as a tracked run input when it is a run dependency, or fetch it directly for workflows that don’t require lineage tracking.
References that have schemes that W&B knows how to handle get downloaded just like artifact files. For more information, see Track external files.
You can download all files in an artifact or download individual files:
Use wandb.Run.use_artifact() to download an artifact as part of a W&B run. W&B records the artifact as an input to the run.
  1. Import the W&B Python SDK and initialize a W&B Run.
  2. Retrieve the artifact version with wandb.Run.use_artifact().
  3. Download all files or a specific file from the returned Artifact object.

Partially download an artifact

You can optionally download part of an artifact based on a prefix. Use the path_prefix= (wandb.Artifact.download(path_prefix=)) parameter to download a single file or the content of a sub-folder.
Alternatively, you can download files from a certain directory. To do so, specify the directory within the path_prefix= parameter. Continuing from the previous code snippet:

Verify downloaded artifact files

After you download an artifact, call wandb.Artifact.verify() to confirm that the local files on disk match the artifact manifest. The following example downloads an artifact as part of a run and verifies the downloaded files:
wandb.Artifact.verify() recomputes checksums for local files and compares them with the checksums in the artifact manifest. Verification fails if a file is missing or modified, or if the directory contains files that are not included in the artifact.
Artifact verification considerations
  • wandb.Artifact.verify() does not verify reference entries.
  • Artifacts created with digest_algorithm="XXH128" require W&B Python SDK version 0.29.0 or newer to use wandb.Artifact.verify(). Earlier SDK versions do not support XXH128 manifest entries, so verification fails.

Use an artifact from a different project

Specify the name of the artifact along with its project name to reference an artifact. You can also reference artifacts across entities by specifying the name of the artifact with its entity name. The following code example demonstrates how to query an artifact from another project as input to the current W&B run.

Construct and use an artifact simultaneously

Simultaneously construct and use an artifact. Create an artifact object and pass it to use_artifact. This creates an artifact in W&B if it does not exist yet. The wandb.Run.use_artifact() API is idempotent, so you can call it as many times as you like.
For more information about constructing an artifact, see Construct an artifact.