Lightning-AI / Lightning-AI/pytorch-lightning
Error when instantiating Logger with **kwargs only arguments via CLI (NeptuneLogger)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
I am running a model via the CLI interface and instantiating the Logger class using the `class_path` and `init_args` format. It works well when the parameters are explicitly defined in the `__init__` method, but it does not work for parameters that are only provided as keyword arguments (kwargs). In the case of the `NeptuneLogger`, the `neptune_run_kwargs` parameters such as `tags` raise an error during the instantiation of the logger.
### What version are you seeing the problem on?
v2.0
### How to reproduce the bug
```python
python train.py fit -c config/model.yaml
```
The `model.yaml` file looks like this:
```yaml
trainer:
logger:
class_path: lightning.pytorch.loggers.NeptuneLogger
init_args:
project: ""
tags:
- "mlp"
- "fast-dev"
```
### Error messages and logs
```
train_embedseq.py: error: Parser key "trainer.logger":
Does not validate against any of the Union subtypes
Subtypes: (, typing.Iterable[lightning.pytorch.loggers.logger.Logger], , )
Errors:
- Problem with the given class_path 'lightning.pytorch.loggers.NeptuneLogger':
'Configuration check failed :: No action for destination key "tags" to check its value.'
- Expected a
- Expected a
- Expected a
Given value type:
Given value: Namespace(class_path='lightning.pytorch.loggers.NeptuneLogger', init_args=Namespace(api_key=None, project='verginer/nlpatent', name=None, log_model_checkpoints=True, prefix='mlp', tags=['embed-seq']))
```
### Environment
_No response_
### More info
_No response_
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 with the CLI command `python train.py fit -c config/model.yaml` and the `NeptuneLogger` class path shown in the configuration. Reproduce the parser error using the YAML `init_args` with `project` and `tags`, then trace how keyword-only arguments are validated. Done means the same configuration instantiates NeptuneLogger without the "No action for destination key" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100