Lightning-AI / Lightning-AI/pytorch-lightning
SaveConfigCallback saves config to the current working directory instead of the logging directory.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Bug description
According to the doc, `SaveConfigCallback` should save config files to dynamic logging directories like `lightning_logs/version_7/config.yaml` by default, but it seems like it just saves to the current working directory, which is the default `trainer.log_dir`.
### How to reproduce the bug
```python
# main.py
from pytorch_lightning.cli import LightningCLI
from pytorch_lightning.demos.boring_classes import BoringModel, BoringDataModule
def main():
LightningCLI(BoringModel, BoringDataModule)
if __name__ == "__main__":
main()
```
```bash
python main.py fit
```
You'll notice that a `config.yaml` is created in the current working directory rather than the log directory.
### Error messages and logs
_No response_
### Environment
Current environment
```
* CUDA:
- GPU:
- NVIDIA GeForce GTX 1060 6GB
- available: True
- version: 11.7
* Lightning:
- lightning-utilities: 0.8.0
- pytorch-lightning: 2.0.0
- torch: 2.0.0
- torchmetrics: 0.11.4
* Packages:
- aiohttp: 3.8.4
- aiosignal: 1.3.1
- async-timeout: 4.0.2
- attrs: 22.2.0
- certifi: 2022.12.7
- charset-normalizer: 3.1.0
- cmake: 3.26.0
- docstring-parser: 0.15
- filelock: 3.10.0
- frozenlist: 1.3.3
- fsspec: 2023.3.0
- idna: 3.4
- importlib-resources: 5.12.0
- jinja2: 3.1.2
- jsonargparse: 4.20.0
- lightning-utilities: 0.8.0
- lit: 16.0.0
- markupsafe: 2.1.2
- mpmath: 1.3.0
- multidict: 6.0.4
- networkx: 3.0
- numpy: 1.24.2
- nvidia-cublas-cu11: 11.10.3.66
- nvidia-cuda-cupti-cu11: 11.7.101
- nvidia-cuda-nvrtc-cu11: 11.7.99
- nvidia-cuda-runtime-cu11: 11.7.99
- nvidia-cudnn-cu11: 8.5.0.96
- nvidia-cufft-cu11: 10.9.0.58
- nvidia-curand-cu11: 10.2.10.91
- nvidia-cusolver-cu11: 11.4.0.1
- nvidia-cusparse-cu11: 11.7.4.91
- nvidia-nccl-cu11: 2.14.3
- nvidia-nvtx-cu11: 11.7.91
- packaging: 23.0
- pip: 23.0.1
- pytorch-lightning: 2.0.0
- pyyaml: 6.0
- requests: 2.28.2
- setuptools: 67.4.0
- sympy: 1.11.1
- tdgu: 0.1.0
- torch: 2.0.0
- torchmetrics: 0.11.4
- tqdm: 4.65.0
- triton: 2.0.0
- typeshed-client: 2.2.0
- typing-extensions: 4.5.0
- urllib3: 1.26.15
- wheel: 0.38.4
- yarl: 1.8.2
* System:
- OS: Linux
- architecture:
- 64bit
- ELF
- processor: x86_64
- python: 3.10.10
- version: #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022
```
### More info
_No response_
cc @carmocca @mauvilsa @borda
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
Start by tracing LightningCLI and SaveConfigCallback using the provided main.py reproduction and `python main.py fit`. Check how the callback chooses its output path relative to trainer.log_dir; done means config.yaml is written under the dynamic logging directory, such as lightning_logs/version_7, rather than the current working directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100