Lightning-AI / Lightning-AI/pytorch-lightning
Inconsistency between the definition of `root_dir` in fabric and pytorch loggers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Outline & Motivation
When trying to fix https://github.com/Lightning-AI/lightning/issues/17138, I found that the definition of `root_dir` in fabric and pytorch is different. Let's say we want the logging dir to be like `tmpdir/some_exp/name/version_0`. Here is a table of the current behaviors:
| | Fabric CSVLogger | Fabric TensorboardLogger | PL CSVLogger | PL TensorboardLogger |
|-|-|-|-|-|
|what user should pass in `init`| `tmpdir/some_exp/name` | `tmpdir/some_exp` | `tmpdir/some_exp` | `tmpdir/some_exp` |
|what `root_dir` stored| `tmpdir/some_exp/name` | `tmpdir/some_exp` | `tmpdir/some_exp/name` | `tmpdir/some_exp/name` |
| has `_get_next_version` implemented | Yes | Yes | No, calling the function from fabric | Yes |
The differences are not obvious because I assume users should use the PL API, but these differences have made the corresponding test modules and internal implementations like `_get_next_version` having different calling conventions and implementations.
### Pitch
Unify the definitions of the `root_dir` variable, and possibly refactor the code to include fewer copies of functions like `_get_next_version`.
### Additional context
_No response_
cc @lantiga @justusschock @borda @awaelchli
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the Fabric and PyTorch Lightning CSVLogger and TensorboardLogger implementations, along with their corresponding test modules, focusing first on root_dir and _get_next_version calling conventions. Done means the loggers use a unified root_dir definition and consistent version handling, with duplicated helper implementations reduced where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100