Explore and traverse artifact graphs
W&B automatically tracks the artifacts a given run logged as well as the artifacts a given run used. Explore the lineage of an artifact with the W&B App UI or programmatically.
Traverse an artifact with the W&B App UI
The graph view shows a general overview of your pipeline.
To view an artifact graph:
- Navigate to your project in the W&B App UI
- Choose the artifact icon on the left panel.
- Select Lineage.
type you provide when you create runs and artifacts are used to create the graph. The input and output of a run or artifact is depicted in the graph with arrows. Artifacts are represented by blue rectangles and Runs are represented by green rectangles.
The artifact type you provide is located in the dark blue header next to the ARTIFACT label. The name of the artifact, along with the artifact version, is shown in the light blue region underneath the ARTIFACT label.
The job type you provide when you initialized a run is located next to the RUN label. The W&B run name is located in the light green region underneath the RUN label.
You can view the type and the name of artifacts both in the left sidebar and in the Lineage tab.
For example, in the proceeding image, an artifact was defined with a type called "raw_dataset" (pink square). The name of the artifact is called "MNIST_raw" (pink line). The artifact was then used for training. The name of the training run is called "vivid-snow-42". That run then produced a "model" artifact (orange square) named "mnist-19pofeku".
For a more detailed view, select the Explode toggle on the upper left hand side of the dashboard. The expanded graph shows details of every run and every artifact in the project that was logged. Try it yourself on this example Graph page.
Traverse an artifact programmatically
Create an artifact object with the W&B Public API (wandb.Api). Provide the name of the project, artifact and alias of the artifact:
api = wandb.Api()
artifact = api.artifact("project/artifact:alias")
# Walk up and down the graph from an artifact:
producer_run = artifact.logged_by()
consumer_runs = artifact.used_by()
Traverse from a run
Create an artifact object with the W&B Public API (wandb.Api.Run). Provide the name of the entity, project, and run ID:
api = wandb.Api()
run = api.run("entity/project/run_id")
# Walk up and down the graph from a run:
logged_artifacts = run.logged_artifacts()
used_artifacts = run.used_artifacts()