Create and view lineage maps
3 minute read
Within a collection in the W&B Registry, you can view a history of the artifacts that an ML experiment uses. This history is called a lineage graph.
You can also view lineage graphs for artifacts you log to W&B that are not part of a collection.
Lineage graphs can show the specific run that logs an artifact. In addition, lineage graphs can also show which run used an artifact as an input. In other words, lineage graphs can show the input and output of a run.
For example, the proceeding image shows artifacts created and used throughout an ML experiment:
From left to right, the image shows:
- Multiple runs log the
split_zoo_dataset:v4
artifact. - The “rural-feather-20” run uses the
split_zoo_dataset:v4
artifact for training. - The output of the “rural-feather-20” run is a model artifact called
zoo-ylbchv20:v0
. - A run called “northern-lake-21” uses the model artifact
zoo-ylbchv20:v0
to evaluate the model.
Track the input of a run
Mark an artifact as an input or dependency of a run with the wandb.init.use_artifact
API.
The proceeding code snippet shows how to use the use_artifact
. Replace values enclosed in angle brackets (< >
) with your values:
import wandb
# Initialize a run
run = wandb.init(project="<project>", entity="<entity>")
# Get artifact, mark it as a dependency
artifact = run.use_artifact(artifact_or_name="<name>", aliases="<alias>")
Track the output of a run
Use (wandb.init.log_artifact
) to declare an artifact as an output of a run.
The proceeding code snippet shows how to use the wandb.init.log_artifact
API. Ensure to replace values enclosed in angle brackets (< >
) with your values:
import wandb
# Initialize a run
run = wandb.init(entity "<entity>", project = "<project>",)
artifact = wandb.Artifact(name = "<artifact_name>", type = "<artifact_type>")
artifact.add_file(local_path = "<local_filepath>", name="<optional-name>")
# Log the artifact as an output of the run
run.log_artifact(artifact_or_path = artifact)
For more information on about creating artifacts, see Create an artifact.
View lineage graphs in a collection
View the lineage of an artifact linked to a collection in the W&B Registry.
- Navigate to the W&B Registry.
- Select the collection that contains the artifact.
- From the dropdown, click the artifact version you want to view its lineage graph.
- Select the “Lineage” tab.
Once you are in an artifact’s lineage graph page, you can view additional information about any node in that lineage graph.
Select a run node to view that run’s details, such as the run’s ID, the run’s name, the run’s state, and more. As an example, the proceeding image shows information about the rural-feather-20
run:
Select an artifact node to view that artifact’s details, such as its full name, type, creation time, and associated aliases.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.