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

Should we support logger=None in the Trainer? #12259

Closed
akashkw opened this issue Mar 7, 2022 · 2 comments
Closed

Should we support logger=None in the Trainer? #12259

akashkw opened this issue Mar 7, 2022 · 2 comments
Labels
logger Related to the Loggers trainer: argument

Comments

@akashkw
Copy link
Contributor

akashkw commented Mar 7, 2022

Background

Currently, the logger parameter in Trainer has the type Union[LightningLoggerBase, Iterable[LightningLoggerBase], bool]. The correct way to specify no logger is to say logger=False, however previously logger=None would work too (if ignoring type-checking errors).

A recent refactor #11920 changed the behavior such that logger=None results in errors, however this was not seen as an issue at the time because it was undefined behavior. We have since discovered that logger=None was being used in some places, so a fix has been made #12249.

Originally posted by @akashkw in #12249 (comment)

Discussion Questions

What approach should we take here? Should we:

  • Change the type of logger to be Optional[Union[LightningLoggerBase, Iterable[LightningLoggerBase], bool]]
  • Insist that users pass in the correct types

cc @awaelchli @edward-io @Borda @ananthsub @rohitgr7 @kamil-kaczmarek @Raalsky @Blaizzy @justusschock @kaushikb11

@ananthsub ananthsub added trainer: argument logger Related to the Loggers labels Mar 7, 2022
@akashkw
Copy link
Contributor Author

akashkw commented Mar 7, 2022

My opinion is that since we allow users to create their own LightningLoggerBase object and pass it into trainer (for example logger=TensorBoardLogger(), it might give users the impression that logger=None should work as well. That would be my intuition, and I would be surprised to discover that it's not supported.

Of course, if type checking warnings pop up then it is an easy fix, but I'm not sure exactly how obvious those warnings are. There are also large parts of the codebase that are not properly typed, so maybe typing alone shouldn't be the only safeguard in this case.

@awaelchli
Copy link
Contributor

Yes let's fix it

@akashkw akashkw changed the title [RFC] Should we support logger=None in the Trainer? Should we support logger=None in the Trainer? Mar 28, 2022
@akashkw akashkw closed this as completed Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger Related to the Loggers trainer: argument
Projects
None yet
Development

No branches or pull requests

3 participants