Skip to content

Default config file fails to initialize module. #11622

@ramonemiliani93

Description

@ramonemiliani93

🐛 Bug

Hi! Not sure if it is a misunderstanding on my side, when the default_config_files is used on the LightningCLI with a file containing the parameters for a LightningModule constructor it fails.

To Reproduce

main.py

from pytorch_lightning.utilities.cli import LightningCLI
from pl_bolts.models import LitMNIST


class MNIST(LitMNIST):
    def __init__(self, foo: int, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.foo = foo


if __name__ == "__main__":
    cli = LightningCLI(MNIST, parser_kwargs={"default_config_files": ["default.yaml"]})

default.yaml

fit:
  model:
    foo: 123

To reproduce just put both on a folder and run python -m main fit inside.

Expected behavior

The fit routine should run with foo=123.

Environment

  • CUDA:
    - GPU:
    - available: False
    - version: None
  • Packages:
    - numpy: 1.22.1
    - pyTorch_debug: False
    - pyTorch_version: 1.10.1
    - pytorch-lightning: 1.5.9
    - tqdm: 4.62.3
  • System:
    - OS: Darwin
    - architecture:
    - 64bit
    -
    - processor: i386
    - python: 3.8.12
    - version: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64

cc @carmocca @mauvilsa

Metadata

Metadata

Assignees

Labels

3rd partyRelated to a 3rd-partybugSomething isn't workinglightningclipl.cli.LightningCLI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions