Open akihironitta opened 2 years ago
Can I take this
edit: added this as a comment to the PR directly.
Can we subclass FutureWarning to create a LightningFutureWarning class? We use the base class internally to log user deprecations, e.g.
class LightningFutureWarning(FutureWarning):
def __init__(self, ...):
super().__init_(...)
log_event(UserDeprecationEvent(msg))
We'll be able to add these logging events to PyTorch Lightning OSS soon, torch.monitor is going to be released in the next version of PyTorch.
@edward-io Sounds good to me. @carmocca Shall we?
@edward-io Why not add that log_event
call to rank_zero_deprecation
instead?
One big downside of using FutureWarning
is that we would need to replace all pytest.deprecated_call
uses. https://github.com/PyTorchLightning/pytorch-lightning/pull/11527 is currently failing for this reason.
One big downside of using
FutureWarning
is that we would need to replace allpytest.deprecated_call
uses. https://github.com/PyTorchLightning/pytorch-lightning/pull/11527 is currently failing for this reason.
Would we need to find/replace these with pytest.warns(FutureWarning) ?
basically a copy of https://github.com/PyTorchLightning/metrics/issues/744 which was addressed in https://github.com/PyTorchLightning/metrics/pull/749
š Feature
see suggestion in https://github.com/PyTorchLightning/metrics/pull/740#discussion_r782088021
Motivation
most of the deprecations in TM are meant to users not developers
Pitch
Replace
DeprecationWarning
withFutureWarning
defined at: https://github.com/PyTorchLightning/pytorch-lightning/blob/033dba1494a177954e8ca59bc74b1635e83b9efa/pytorch_lightning/utilities/warnings.py#L44 and remove: https://github.com/PyTorchLightning/pytorch-lightning/blob/033dba1494a177954e8ca59bc74b1635e83b9efa/pytorch_lightning/utilities/warnings.py#L48-L49Alternatives
Keep using
DeprecationWarning
.Additional context
exception
DeprecationWarning
Base class for warnings about deprecated features when those warnings are intended for other Python developers. Ignored by the default warning filters, except in the__main__
module (PEP 565). Enabling the Python Development Mode shows this warning.exception
FutureWarning
Base class for warnings about deprecated features when those warnings are intended for end users of applications that are written in Python.If you enjoy Lightning, check out our other projects! ā”
Metrics: Machine learning metrics for distributed, scalable PyTorch applications.
Lite: enables pure PyTorch users to scale their existing code on any kind of device while retaining full control over their own loops and optimization logic.
Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, fine-tuning, and solving problems with deep learning.
Bolts: Pretrained SOTA Deep Learning models, callbacks, and more for research and production with PyTorch Lightning and PyTorch.
Lightning Transformers: Flexible interface for high-performance research using SOTA Transformers leveraging Pytorch Lightning, Transformers, and Hydra.
cc @borda