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 to 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:

Use an artifact from a different project

Specify the name of 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.