Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self.logger undefined on SignatureArguments. #92

Closed
ramonemiliani93 opened this issue Sep 21, 2021 · 2 comments
Closed

self.logger undefined on SignatureArguments. #92

ramonemiliani93 opened this issue Sep 21, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ramonemiliani93
Copy link

Hi I have been trying to skip an argument on a LightningCLI from pytorch_lightning but it is unable to log the skipped parameter and therefore fails. I also glimpsed through the class but couldn't find the definition for the logger.

import dataclasses

import pytorch_lightning as pl
from pytorch_lightning.utilities.cli import LightningCLI


@dataclasses.dataclass
class Foo:
    bar: int
    skip: int


class ErrorCLI(LightningCLI):

    def add_arguments_to_parser(self, parser):
        group = parser.add_argument_group("group")
        group.add_class_arguments(Foo, skip={"skip"})


if __name__ == "__main__":
    cli = ErrorCLI(pl.LightningModule)

If you save the snippet as trainer.py and run python trainer.py fit --print_config > default.yaml it will fail in signatures.py when logging the skipped parameter:

AttributeError: '_ArgumentGroup' object has no attribute 'logger'

If the group is removed then it stops failing. If this should be moved to pytorch lightning let me know!

@mauvilsa mauvilsa added the bug Something isn't working label Sep 22, 2021
@mauvilsa
Copy link
Member

Thanks for reporting. Will look at it.

@mauvilsa
Copy link
Member

Fixed. Will be included in the next patch or minor release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants