Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lightning/fabric/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed device handling in `Fabric.setup()` when the model has no parameters ([#17441](https://github.com/Lightning-AI/lightning/pull/17441))


- Fixed computing the next version folder in `CSVLogger` ([#17139](https://github.com/Lightning-AI/lightning/pull/17139))


## [2.0.1.post0] - 2023-04-11

No changes
Expand Down
7 changes: 4 additions & 3 deletions src/lightning/fabric/loggers/csv_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ def _get_next_version(self) -> int:
return 0

existing_versions = []
for d in self._fs.listdir(root_dir, detail=False):
name = d[len(root_dir) + 1 :] # removes parent directories
if self._fs.isdir(d) and name.startswith("version_"):
for d in self._fs.listdir(root_dir):
full_path = d["name"]
name = os.path.basename(full_path)
if self._fs.isdir(full_path) and name.startswith("version_"):
existing_versions.append(int(name.split("_")[1]))

if len(existing_versions) == 0:
Expand Down
3 changes: 3 additions & 0 deletions src/lightning/pytorch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- The `WandbLogger` no longer flattens dictionaries in the hyperparameters logged to the dashboard ([#17574](https://github.com/Lightning-AI/lightning/pull/17574))


- Fixed computing the next version folder in `CSVLogger` ([#17139](https://github.com/Lightning-AI/lightning/pull/17139))


## [2.0.1.post0] - 2023-04-11

### Fixed
Expand Down
11 changes: 11 additions & 0 deletions tests/tests_fabric/loggers/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ def test_file_logger_automatic_versioning(tmpdir):
assert logger.version == 2


def test_file_logger_automatic_versioning_relative_root_dir(tmpdir, monkeypatch):
"""Verify that automatic versioning works, when root_dir is given a relative path."""
root_dir = tmpdir.mkdir("exp")
logs_dir = root_dir.mkdir("logs")
logs_dir.mkdir("version_0")
logs_dir.mkdir("version_1")
monkeypatch.chdir(tmpdir)
logger = CSVLogger(root_dir="exp/logs", name="logs")
assert logger.version == 2


def test_file_logger_manual_versioning(tmpdir):
"""Verify that manual versioning works."""
root_dir = tmpdir.mkdir("exp")
Expand Down