Lightning-AI / Lightning-AI/pytorch-lightning
`barebones` mode should be more forceful
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Description & Motivation
Currently, if I want to use `Trainer(barebones=True)`, I must also manually deactivate (change values in my code, or comment out lines) all the things that barebones mode skips.
This is not the end of the world when I control the code. But the problem I have at the moment is that I'm using GluonTS, which creates a PytorchLightning module, and they add their own checkpointing which I can't turn off ([their code](https://github.com/awslabs/gluonts/blob/43e78d3aa8c9a475c146672bbb26e04e70f567bc/src/gluonts/torch/model/estimator.py#L196-L207)). Which means I can't use barebones mode.
### Pitch
When `barebones=True`, the trainer should run in barebones mode, regardless of anything that is currently considered a 'misconfiguration'.
Logging warnings for misconfigurations is probably sensible, but not allowing training to proceed seems overkill.
In general (ignoring third party situations) it would great to be able to easily turn this mode on, say, during a hyperparameter optimization sweep, without having to fuddle with a bunch of other code to prevent it from raising errors.
### Alternatives
_No response_
### Additional context
This bit of the code in `trainer.py` looks odd:
```py
if enable_checkpointing:
raise ValueError(
f"`Trainer(barebones=True, enable_checkpointing={enable_checkpointing!r})` was passed."
" Checkpointing can impact raw speed so it is disabled in barebones mode."
)
enable_checkpointing = False
```
It raises if `enable_checkpointing` isn't false, but then sets `enable_checkpointing=False`. Then later it prints a whole `deactivated` message, but unless I'm missing something, it isn't actually deactivating anything because if there's anything to be deactivated it raises an error.
cc @borda @justusschock @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
Start in trainer.py at the barebones handling around enable_checkpointing, and compare the validation and deactivated-message behavior described in the issue. Check how Trainer(barebones=True) handles other settings that are considered misconfigurations, then verify that training can proceed while the relevant features remain disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100