-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Less noisy console output #20154
Comments
You can adjust the logging level to your preferred value with Also cc @LysandreJik |
Thanks @sgugger, I just tried that. There's still plenty of noise from code in HF (datasets) like this: logger.warning(f"Loading cached processed dataset at {cache_file_name}") Also, |
You'll need to do the same thing for |
I've got a full schedule with study at the moment, sorry. So in summary this looks like 2.5 issues:
|
I disagree with the first two, and even if I did, it's too late to change it without surprising the whole user community. The only issue I see is the bug in |
Ah, interesting, I thought the first one was quite clear cut. From the Python logging how-to:
But I do agree that too much change for minor things is not great, so fair enough if you want to stick with things the way they are. But for me, this makes Huggingface harder to work with than it needs to be, swamping out my own logging. I'm quite surprised it's intentional! |
Ah sorry I misread, I do agree with you on the first comment, and this one might be something we can change as a warning is indeed too strong for this message. |
Just dug in the code base and didn't find any obvious |
Oh good! :) Yes I just checked and this is actually coming from the datasets package. |
Ok, so you should open an issue there. Agreed with you that those should be info (and it's the reason you will see most of our examples set the log level of datasets to Error, to avoid getting those warnings). |
@sgugger something else I've just noticed is that sometimes transformers will set the log level to info. I can't pin down exactly when, but I see that there's lots of code that calls Is that intentional? I don't understand the logic of a module globally changing the log level to INFO. |
Only scripts do this (mostly conversion scripts of models from their original repos to Transformers), not the module itself. |
Hmm, are these scripts ever called from the application code? There's definitely something that sets the log level to INFO, and I think it's related to loading a model for the first time (which is why it's hard to replicate). |
Actually I'm going to re-open this, since there's still the bug of Please do let me know if I'm wasting my time reporting these issues, maybe there's bigger fish to fry and no interest in fiddling with logging. |
I'm not sure I understand the bug here. Creating the |
No, if I have log level set to WARNING (the default) and create a This code: print(f"Verbosity: {transformers.logging.get_verbosity()}")
trainer = transformers.Trainer(
model=model,
args=TrainingArguments(
output_dir=dg.get_root_dir("logs/hf"),
evaluation_strategy="epoch",
report_to=None,
fp16=True,
),
train_dataset=dataset["train"],
eval_dataset=dataset["validation"],
data_collator=DataCollatorWithPadding(tokenizer=tokenizer),
)
print(f"Verbosity: {transformers.logging.get_verbosity()}") |
Yes, because you have left the logging value of the Just so I understand better, you would like the |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Feature request
I have just started using HF transformers and am struck by the amount of text it dumps into the console.
Just following the steps in the course, a simple script that loads a model and trains it spews out this:
...my monitor isn't big enough to screenshot it all :)
Note that I'm using PyCharm, and specifically the built in "Python Console".
Motivation
This is a problem because now a user has two options:
Also, it's just not very pretty, and pretty is nice.
Your contribution
Only suggestions/questions:
sys.stdout.isatty()
. tqdm simply doesn't work well when not in a terminal (beyond a simple indicator, as long as you don't print anything while the indicator is active). So a good solution is to simply print the results at the end for these environments.I hope this is useful and not just me complaining...
The text was updated successfully, but these errors were encountered: