Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a bug that causes CSVLogger to overwrite version_0 when root_dir is a relative path. #17139

Merged
merged 17 commits into from
May 6, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -158,9 +158,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):
water-vapor marked this conversation as resolved.
Show resolved Hide resolved
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