INCREMENTAL
mode is supported on W&B Server v0.70.0 and above.Create and log a table
- Initialize a new run with
wandb.init()
. - Create a Table object with the
wandb.Table
Class. Specify the columns and data for the table for thecolumns
anddata
parameters, respectively. It is recommended to set the optionallog_mode
parameter to one of the three modes:IMMUTABLE
(the default),MUTABLE
, orINCREMENTAL
. See Table Logging Modes in the next section for more information. - Log the table to W&B with
run.log()
.
a
and b
, and two rows of data, ["a1", "b1"]
and ["a2", "b2"]
:
Logging modes
Thewandb.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:
Mode | Definition | Use Cases | Benefits |
---|---|---|---|
IMMUTABLE | Once a table is logged to W&B, you cannot modify it. | - Storing tabular data generated at the end of a run for further analysis | - Minimal overhead when logged at the end of a run - All rows rendered in UI |
MUTABLE | After you log a table to W&B, you can overwrite the existing table with a new one. | - Adding columns or rows to existing tables - Enriching results with new information | - Capture Table mutations - All rows rendered in UI |
INCREMENTAL | Add batches of new rows to a table throughout the machine learning experiment. | - Adding rows to tables in batches - Long-running training jobs - Processing large datasets in batches - Monitoring ongoing results | - View updates on UI during training - Ability to step through increments |
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.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.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.
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.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.
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")
.