Skip to content

Wrong warnings module used in lightning module #14231

@roytseng-tw

Description

@roytseng-tw

🐛 Bug

https://github.com/Lightning-AI/lightning/blob/2622989b108368813fdd3850b002fd1ad69988c2/src/pytorch_lightning/core/module.py#L41
https://github.com/Lightning-AI/lightning/blob/2622989b108368813fdd3850b002fd1ad69988c2/src/pytorch_lightning/core/module.py#L280-L282

L280-L282 intend to use python warnings module instead of the one defined in pytorch lightning.

To Reproduce

Use multiple loggers:
pl.trainer(loggers=[logger1, logger2], ...)

Expected behavior

Since pytorch_lightning.utilities.warnings isn't used anywhere in the file, the solution will be:

  1. remove the wrong warnings import.
  2. add import warnings

Environment

Doesn't really matter.

  • Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow):
  • PyTorch Lightning Version (e.g., 1.5.0):
  • Lightning App Version (e.g., 0.5.2):
  • PyTorch Version (e.g., 1.10):
  • Python version (e.g., 3.9):
  • OS (e.g., Linux):
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source):
  • If compiling from source, the output of torch.__config__.show():
  • Running environment of LightningApp (e.g. local, cloud):
  • Any other relevant information:

Additional context

cc @awaelchli @edward-io @Borda @ananthsub @rohitgr7 @kamil-kaczmarek @Raalsky @Blaizzy @carmocca @justusschock @ninginthecloud @jjenniferdai

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglightningmodulepl.LightningModuleloggerRelated to the Loggers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions