Skip to main content
Visualize and log tabular data with W&B Tables. A W&B Table is a two-dimensional grid of data where each column has a single type of data. Each row represents one or more data points logged to a W&B run. W&B Tables support primitive and numeric types, as well as nested lists, dictionaries, and rich media types. A W&B Table is a specialized data type in W&B, logged as an artifact object. You create and log table objects using the W&B Python SDK. When you create a table object, you specify the columns and data for the table and a mode. The mode determines how the table is logged and updated during your ML experiments.
INCREMENTAL mode is supported on W&B Server v0.70.0 and above.

Create and log a table

  1. Initialize a new run with wandb.init().
  2. Create a Table object with the wandb.Table Class. Specify the columns and data for the table for the columns and data parameters, respectively. It is recommended to set the optional log_mode parameter to one of the three modes: IMMUTABLE (the default), MUTABLE, or INCREMENTAL. See Table Logging Modes in the next section for more information.
  3. Log the table to W&B with run.log().
The following example shows how to create and log a table with two columns, a and b, and two rows of data, ["a1", "b1"] and ["a2", "b2"]:

Logging modes

The wandb.Table log_mode parameter determines how a table is logged and updated during your ML experiments. The log_mode parameter accepts one of three arguments: IMMUTABLE, MUTABLE, and INCREMENTAL. Each mode has different implications for how a table is logged, how it can be modified, and how it is rendered in the W&B App. The following describes the three logging modes, the high-level differences, and common use case for each mode: The next sections show example code snippets for each mode along with considerations when to use each mode.

MUTABLE mode

MUTABLE mode updates an existing table by replacing the existing table with a new one. MUTABLE mode is useful when you want to add new columns and rows to an existing table in a non iterative process. Within the UI, the table is rendered with all rows and columns, including the new ones added after the initial log.
In MUTABLE mode, the table object is replaced each time you log the table. Overwriting a table with a new one is computationally expensive and can be slow for large tables.
The following example shows how to create a table in MUTABLE mode, log it, and then add new columns to it. The table object is logged three times: once with the initial data, once with the confidence scores, and once with the final predictions.
The following example uses a placeholder function load_eval_data() to load data and a placeholder function model.predict() to make predictions. You will need to replace these with your own data loading and prediction functions.
If you only want to add new batches of rows (no columns) incrementally like in a training loop, consider using INCREMENTAL mode instead.

INCREMENTAL mode

In incremental mode, you log batches of rows to a table during the machine learning experiment. This is ideal for monitoring long-running jobs or when working with large tables that would be inefficient to log during the run for updates. Within the UI, the table is updated with new rows as they are logged, allowing you to view the latest data without having to wait for the entire run to finish. You can also step through the increments to view the table at different points in time.
Run workspaces in the W&B App have a limit of 100 increments. If you log more than 100 increments, only the most recent 100 are shown in the run workspace.
The following example creates a table in INCREMENTAL mode, logs it, and then adds new rows to it. Note that the table is logged once per training step (step).
The following example uses a placeholder function get_training_batch() to load data, a placeholder function train_model_on_batch() to train the model, and a placeholder function predict_on_batch() to make predictions. You will need to replace these with your own data loading, training, and prediction functions.
Incremental logging is generally more computationally efficient than logging a new table each time (log_mode=MUTABLE). However, the W&B App may not render all rows in the table if you log a large number of increments. If your goal is to update and view your table data while your run is ongoing and to have all the data available for analysis, consider using two tables. One with INCREMENTAL log mode and one with IMMUTABLE log mode. The following example shows how to combine INCREMENTAL and IMMUTABLE logging modes to achieve this.
In this example, the incr_table is logged incrementally (with log_mode="INCREMENTAL") during training. This allows you to log and view updates to the table as new data is processed. At the end of training, an immutable table (final_table) is created with all data from the incremental table. The immutable table is logged to preserve the complete dataset for further analysis and it enables you to view all rows in the W&B App.

Examples

Enriching evaluation results with MUTABLE

Resuming runs with INCREMENTAL tables

You can continue logging to an incremental table when resuming a run:
Increments are logged to a new table if you turn off summaries on a key used for the incremental table using wandb.Run.define_metric("<table_key>", summary="none") or wandb.Run.define_metric("*", summary="none").

Training with INCREMENTAL batch training