Skip to content

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

@akashkw

Description

@akashkw

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions