Don't hardcode the logger level to INFO; let users set TRANSFORMERS_VERBOSITY #2047
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR stop the hardcoding of the logger level to INFO in various files. Currently, this hardcoding prevents
TRANSFORMERS_VERBOSITY
from working and unexpectedly sets the default logs as INFO rather than WARNING.Beyond that,
optimum
is often used "behind the scenes" (or at least, it likely should be), and those modules should be very quiet apart from big warnings or errors, in my opinion. Otherwise, info logs such asmight confuse users into thinking that something is wrong with their
transformers
, RAG tool, etc., and logs such asdon't do anything more than spam the terminal. It's good that these logs exist, but people should opt into these by setting the logger level to INFO rather than having them enabled by default.
Fixes #2044 (comment)
Here's some scripts to help me make my case:
Script 1
This script relies on an unreleased Sentence Transformers release, so it's a bit hard to reproduce, but it should paint a picture of the before vs after:
Before
After
We now have 2 warnings from Sentence Transformers (about that we're exporting & to recommend saving), 2 warnings from onnxruntime which make sense, and a warning from optimum regarding
disable_embed_layer_norm
. This is much more manageable, especially because a lot of the logs that we don't see here anymore don't matter to the average person. These are the removed logs:Script 2
Before
After
Before submitting
Who can review?
@echarlaix @JingyaHuang @regisss @xenova