SwanLab Logging in NeMo AutoModel
Introduction
SwanLab is an experiment tracker with a W&B-compatible API. NeMo AutoModel can log every run to SwanLab in addition to Weights & Biases, which is also useful where the W&B servers are not reachable.
SwanLab logging mirrors the W&B logger instead of adding a second set of logging calls to every recipe: when it is enabled, each wandb.init, wandb.log, wandb.config.update, and finish a recipe makes is forwarded to SwanLab. SwanLab therefore records the same items as W&B: the project, run name, tags, group, notes, the full run config, and every logged metric at the same step (see Notes for one difference).
Prerequisites
Install the swanlab extra (it pulls in wandb as well):
Provide your SwanLab API key through the SWANLAB_API_KEY environment variable (or run swanlab login once). The key is never part of the YAML.
Configuration
Add a swanlab sub-block to the recipe’s wandb section:
The run keeps logging to W&B as before and is also logged to SwanLab under the same project and run name.
Configuration Parameters
SwanLab Only
Where W&B is not reachable, keep the wandb block (it drives the logging calls) and stop the W&B upload:
Offline Clusters
On a cluster without internet access, write the run locally and upload it later from a machine that can reach SwanLab:
Notes
- Numbers, strings, and images are mirrored. String values (for example the per-step
timestamp) appear in SwanLab as text. Other W&B types such aswandb.Tableand histograms are not mirrored. - When a recipe logs the same key twice at one step (for example a training and a validation record at the same step), W&B keeps the last value and SwanLab keeps the first.
- A resumed W&B run (
id/resumein thewandbblock) starts a new SwanLab run. - With
upload_to_wandb: false, W&B always runs inofflinemode, even if thewandbblock sets anothermode. - The mirror is installed once per process; a second recipe in the same process keeps the first run’s SwanLab settings.