Skip to content

Commit e6cecc9

Browse files
committed
docs: enhance docstring for log_hparams method in CSVLogger class
1 parent 391f3ab commit e6cecc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/lightning/pytorch/loggers/csv_logs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,16 @@ def log_hyperparams(self, params: Optional[Union[dict[str, Any], Namespace]] = N
148148
"""Log hyperparameters to YAML format.
149149
150150
Hyperparameters are saved to ``hparams.yaml`` in the log directory.
151+
This method is automatically called when using ``self.save_hyperparameters()``
152+
in your LightningModule, but can also be called manually.
151153
152154
Args:
153155
params: Dictionary or Namespace containing hyperparameters to log.
156+
157+
Example:
158+
>>> logger = CSVLogger("logs")
159+
>>> logger.log_hyperparams({"learning_rate": 0.001, "batch_size": 32})
160+
>>> # This creates logs/lightning_logs/version_0/hparams.yaml
154161
"""
155162
params = _convert_params(params)
156163
self.experiment.log_hparams(params)

0 commit comments

Comments
 (0)