Skip to content

Commit

Permalink
fixed decor to show messages only when the wrapped object is called. (N…
Browse files Browse the repository at this point in the history
…VIDIA#6793)

Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
  • Loading branch information
XuesongYang authored Jun 5, 2023
1 parent aa1986f commit aa21e8a
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions nemo/utils/decorators/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@

__all__ = ['experimental']

from nemo.utils import logging


def experimental(cls):
""" Decorator which indicates that module is experimental.
Use it to mark experimental or research modules.
"""
import wrapt

def wrapped(cls):
logging.warning(
f'Module {cls} is experimental, not ready for production and is not fully supported. Use at your own risk.'
)
from nemo.utils import logging

return cls

return wrapped(cls=cls)
@wrapt.decorator
def experimental(wrapped, instance, args, kwargs):
logging.warning(f"`{wrapped}` is experimental and not ready for production yet. Use at your own risk.")
return wrapped(*args, **kwargs)

0 comments on commit aa21e8a

Please sign in to comment.