Open adosar opened 1 month ago
Hey @adosar
Hmm, Lightning doesn't have a concept of a "default optimizer", so I don't think the CLI / jsonargparse could ever know what that should be in your model. The default is simply whatever you specify in your return statement of the configure_optimizers()
.
@adosar the current behavior comes from https://github.com/omni-us/jsonargparse/pull/90. Maybe the default should be None
instead of SUPPRESS
. I am not sure this moment if changing that would have unexpected consequences. But note, with this in the saved config there would be optimizer: null
. Is this what you are expecting?
Also note that the automatic configure_optimizers
is just for convenience to support the most basic cases. But to have configurable optimizers, the recommended approach is to do as described here.
@mauvilsa Yes, this is what I was expecting: optimizer: null
. This is of course just my opinion, but I think including all the configuration settings even those not explicitly given is in full accordance with:
by default LightningCLI automatically saves the full YAML configuration in the log directory.
However, since the configuration of optimizers/schedulers doesn't cover all the cases, it might be more appropriate to just emphasize it in the docs.
Bug description
From the Docs:
I would expect the saved
config.yaml
to include the options for--optimizer
etc. even if they were not passed, just like it populates theconfig.yaml
with--seed_everything
even if it wasn't explicitly passed in the CLI.What version are you seeing the problem on?
v2.2
How to reproduce the bug
Now from the console:
Error messages and logs
The
config.yaml
underlightning_logs/version_0
is this:Environment
Current environment
``` #- PyTorch Lightning Version (e.g., 1.5.0): #- PyTorch Version (e.g., 2.0): #- Python version (e.g., 3.9): #- OS (e.g., Linux): #- CUDA/cuDNN version: #- GPU models and configuration: #- How you installed Lightning(`conda`, `pip`, source): ```More info
No response
cc @carmocca @mauvilsa