wandb
optimus_dl.modules.loggers.wandb
¶
Weights & Biases (wandb) metrics logger implementation.
This logger integrates with Weights & Biases for experiment tracking, supporting both online and offline modes.
WandbLogger
¶
Bases: BaseMetricsLogger
Weights & Biases metrics logger.
Logs training metrics, configuration, and optionally model artifacts to Weights & Biases for experiment tracking and visualization.
Supports resuming runs by storing and reloading the WandB run_id from
the training state dict.
Source code in optimus_dl/modules/loggers/wandb.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
__init__(cfg, state_dict=None, **kwargs)
¶
Initialize WandB logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
WandbLoggerConfig
|
WandB logger configuration. |
required |
state_dict
|
Optional state containing 'run_id' for resuming. |
None
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Source code in optimus_dl/modules/loggers/wandb.py
close()
¶
Finalize and close the WandB run.
Source code in optimus_dl/modules/loggers/wandb.py
log_metrics(metrics, step, group='train')
¶
Flatten and log metrics to WandB.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
dict[str, Any]
|
Dictionary of metric names to values. |
required |
step
|
int
|
Training step/iteration number. |
required |
group
|
str
|
Metrics group (e.g., 'train', 'eval'). |
'train'
|
Source code in optimus_dl/modules/loggers/wandb.py
setup(experiment_name, config)
¶
Initialize a WandB run with experiment metadata and configuration.
If self.run_id is present, attempts to resume the existing run.
Source code in optimus_dl/modules/loggers/wandb.py
WandbLoggerConfig
dataclass
¶
Bases: MetricsLoggerConfig
Configuration for Weights & Biases logger.
Attributes:
| Name | Type | Description |
|---|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str | None
|
|
None
|
entity
|
str | None
|
|
None
|
mode
|
str
|
|
'online'
|
save_code
|
bool
|
|
True
|
group
|
str | None
|
|
None
|
job_type
|
str | None
|
|
'train'
|
name
|
str | None
|
|
None
|
log_model
|
bool
|
|
False
|
log_gradients
|
bool
|
|
False
|