-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Replace deprecated logger.warn with warning #16876
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -306,7 +306,7 @@ def __init__(self, **kwargs): | |||||||||||||||||||||||||||||
if self.id2label is not None: | ||||||||||||||||||||||||||||||
num_labels = kwargs.pop("num_labels", None) | ||||||||||||||||||||||||||||||
if num_labels is not None and len(self.id2label) != num_labels: | ||||||||||||||||||||||||||||||
logger.warn( | ||||||||||||||||||||||||||||||
logger.warning( | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's our internal logger here no - not Python's logger. So not sure about this change @LysandreJik There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logging module imported in this script is indeed our internal logging module that lives under the
If we inspect the internal logging module in
The get_logger function simply returns the getLogger function from this Python logging module:transformers/src/transformers/utils/logging.py Lines 113 to 124 in 72728be
Hence, our internal logger is implicitly derived from its parent Python logger, and is simply a wrapper for this module. Consequently, the advice regarding the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Referring to @LysandreJik here :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's a good change! |
||||||||||||||||||||||||||||||
f"You passed along `num_labels={num_labels}` with an incompatible id to label map: " | ||||||||||||||||||||||||||||||
f"{self.id2label}. The number of labels wil be overwritten to {self.num_labels}." | ||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we don't actively maintain those ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Just covering all grounds!