0
# Logging and Monitoring
1
2
Integration with popular experiment tracking platforms and comprehensive logging capabilities for monitoring training progress, metrics, hyperparameters, and model artifacts.
3
4
## Capabilities
5
6
### TensorBoard Logger
7
8
Integration with TensorBoard for visualizing training metrics, model graphs, and embeddings.
9
10
```python { .api }
11
class TensorBoardLogger:
12
def __init__(
13
self,
14
save_dir: str,
15
name: str = "lightning_logs",
16
version: Optional[Union[int, str]] = None,
17
log_graph: bool = False,
18
default_hp_metric: bool = True,
19
prefix: str = "",
20
sub_dir: Optional[str] = None,
21
**kwargs
22
):
23
"""Initialize TensorBoard logger."""
24
```
25
26
### Weights & Biases Logger
27
28
Integration with Weights & Biases for experiment tracking and collaboration.
29
30
```python { .api }
31
class WandbLogger:
32
def __init__(
33
self,
34
name: Optional[str] = None,
35
save_dir: Optional[str] = None,
36
offline: bool = False,
37
id: Optional[str] = None,
38
anonymous: Optional[bool] = None,
39
version: Optional[str] = None,
40
project: Optional[str] = None,
41
log_model: Union[str, bool] = False,
42
experiment: Optional[Run] = None,
43
prefix: str = "",
44
checkpoint_name: Optional[str] = None,
45
**kwargs
46
):
47
"""Initialize Weights & Biases logger."""
48
```
49
50
### MLFlow Logger
51
52
Integration with MLFlow for experiment tracking and model registry.
53
54
```python { .api }
55
class MLFlowLogger:
56
def __init__(
57
self,
58
experiment_name: Optional[str] = None,
59
run_name: Optional[str] = None,
60
tracking_uri: Optional[str] = None,
61
tags: Optional[Dict[str, Any]] = None,
62
save_dir: Optional[str] = "./mlruns",
63
log_model: Union[str, bool] = False,
64
prefix: str = "",
65
artifact_location: Optional[str] = None,
66
run_id: Optional[str] = None,
67
**kwargs
68
):
69
"""Initialize MLFlow logger."""
70
```
71
72
### CSV Logger
73
74
Simple CSV file logging for basic experiment tracking.
75
76
```python { .api }
77
class CSVLogger:
78
def __init__(
79
self,
80
save_dir: str,
81
name: str = "lightning_logs",
82
version: Optional[Union[int, str]] = None,
83
prefix: str = "",
84
flush_logs_every_n_steps: int = 100
85
):
86
"""Initialize CSV logger."""
87
```
88
89
### Comet Logger
90
91
Integration with Comet ML for experiment tracking and model comparison.
92
93
```python { .api }
94
class CometLogger:
95
def __init__(
96
self,
97
api_key: Optional[str] = None,
98
workspace: Optional[str] = None,
99
save_dir: Optional[str] = None,
100
project_name: Optional[str] = None,
101
rest_api_key: Optional[str] = None,
102
experiment_name: Optional[str] = None,
103
experiment_key: Optional[str] = None,
104
offline: bool = False,
105
prefix: str = "",
106
**kwargs
107
):
108
"""Initialize Comet logger."""
109
```
110
111
### Neptune Logger
112
113
Integration with Neptune AI for experiment management and model registry.
114
115
```python { .api }
116
class NeptuneLogger:
117
def __init__(
118
self,
119
api_key: Optional[str] = None,
120
project: Optional[str] = None,
121
name: Optional[str] = None,
122
run: Optional[Run] = None,
123
log_model_checkpoints: bool = True,
124
prefix: str = "",
125
**kwargs
126
):
127
"""Initialize Neptune logger."""
128
```
129
130
### Base Logger
131
132
Base class for implementing custom loggers.
133
134
```python { .api }
135
class Logger:
136
def __init__(self):
137
"""Initialize base logger."""
138
139
def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) -> None:
140
"""Log metrics to the logger."""
141
142
def log_hyperparams(self, params: Dict[str, Any]) -> None:
143
"""Log hyperparameters to the logger."""
144
145
def save(self) -> None:
146
"""Save logged data."""
147
148
def finalize(self, status: str) -> None:
149
"""Finalize the logger with status."""
150
```