Skip to content

Commit 0235543

Browse files
authored
Make CSVLogger(name: ...) optional str (#19518)
1 parent a41528c commit 0235543

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/lightning/fabric/loggers/csv_logs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class CSVLogger(Logger):
3737
3838
Args:
3939
root_dir: The root directory in which all your experiments with different names and versions will be stored.
40-
name: Experiment name. Defaults to ``'lightning_logs'``.
40+
name: Experiment name. Defaults to ``'lightning_logs'``. If name is ``None``, logs
41+
(versions) will be stored to the save dir directly.
4142
version: Experiment version. If version is not specified the logger inspects the save
4243
directory for existing versions, then automatically assigns the next available version.
4344
If the version is specified, and the directory already contains a metrics file for that version, it will be
@@ -60,7 +61,7 @@ class CSVLogger(Logger):
6061
def __init__(
6162
self,
6263
root_dir: _PATH,
63-
name: str = "lightning_logs",
64+
name: Optional[str] = "lightning_logs",
6465
version: Optional[Union[int, str]] = None,
6566
prefix: str = "",
6667
flush_logs_every_n_steps: int = 100,

src/lightning/pytorch/loggers/csv_logs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class CSVLogger(Logger, FabricCSVLogger):
8282
8383
Args:
8484
save_dir: Save directory
85-
name: Experiment name. Defaults to ``'lightning_logs'``.
85+
name: Experiment name, optional. Defaults to ``'lightning_logs'``. If name is ``None``, logs
86+
(versions) will be stored to the save dir directly.
8687
version: Experiment version. If version is not specified the logger inspects the save
8788
directory for existing versions, then automatically assigns the next available version.
8889
prefix: A string to put at the beginning of metric keys.
@@ -95,7 +96,7 @@ class CSVLogger(Logger, FabricCSVLogger):
9596
def __init__(
9697
self,
9798
save_dir: _PATH,
98-
name: str = "lightning_logs",
99+
name: Optional[str] = "lightning_logs",
99100
version: Optional[Union[int, str]] = None,
100101
prefix: str = "",
101102
flush_logs_every_n_steps: int = 100,

0 commit comments

Comments
 (0)