Skip to main content

Overview

Metaflow is a framework created by Netflix for creating and running ML workflows. This integration lets you apply decorators to Metaflow steps and flows to automatically log parameters and artifacts to W&B, so you can track experiments and inspect lineage across the workflows you build with Metaflow without writing custom logging code:
  • Decorating a step turns logging off or on for certain types within that step.
  • Decorating the flow turns logging off or on for every step in the flow.

Quickstart

The following sections explain how to authenticate with W&B, install the required libraries, and add the wandb_log decorator to your Metaflow steps and flows.

Sign up and create an API key

An API key authenticates your machine to W&B. You can generate an API key from your user profile.
For a more streamlined approach, go to User Settings and create an API key. Copy the API key immediately and save it in a secure location such as a password manager.
To find your API key in the W&B app:
  1. Click your user profile icon in the upper right corner.
  2. Select User Settings, then scroll to the API Keys section.

Install the wandb library and log in

To install the wandb library locally and log in:
For wandb version 0.19.8 or below, install fastcore version 1.8.0 or below (fastcore<1.8.0) instead of plum-dispatch.
  1. Set the WANDB_API_KEY environment variable to your API key. Replace values enclosed in <> with your own:
  2. Install the wandb library and log in.

Decorate your flows and steps

Decorating a step turns logging off or on for certain types within that step.In this example, the integration logs all datasets and models in start:

Access your data programmatically

Once your flows and steps are decorated, runs send parameters and artifacts to W&B each time the flow executes. You can access the captured information in three ways: inside the original Python process being logged using the wandb client library, with the web app UI, or programmatically using the Public API. Parameters are saved to the W&B config and can be found in the Overview tab. datasets, models, and others are saved to W&B Artifacts and can be found in the Artifacts tab. Base python types are saved to the W&B summary dict and can be found in the Overview tab. See the guide to the Public API for details on using the API to get this information programmatically from outside.

Quick reference

wandb_log kwargs

Frequently asked questions

The following sections answer common questions about logging behavior, supported data types, and artifact lineage.

What exactly do you log

wandb_log only logs instance variables. Local variables are never logged. This is useful to avoid logging unnecessary data.

Which data types get logged

W&B supports these types:

Configure logging behavior

Artifact lineage tracking

If you have an artifact that is an output of step A and an input to step B, W&B automatically constructs the lineage directed acyclic graph (DAG) for you. For an example of this behavior, see this Metaflow integration example notebook and its corresponding Artifacts page.