Skip to content
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

FIX: Fix error with logger.warning + inline with recent refactor #29039

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

younesbelkada
Copy link
Contributor

What does this PR do?

In fact current on transformers main some legacy setup that call model._is_quantized_training_enabled throw an error:

Arguments: (<class 'FutureWarning'>,)
--- Logging error ---
Traceback (most recent call last):
  File "/home/younes_huggingface_co/miniconda3/envs/fix-test/lib/python3.9/logging/__init__.py", line 1083, in emit
    msg = self.format(record)
  File "/home/younes_huggingface_co/miniconda3/envs/fix-test/lib/python3.9/logging/__init__.py", line 927, in format
    return fmt.format(record)
  File "/home/younes_huggingface_co/miniconda3/envs/fix-test/lib/python3.9/logging/__init__.py", line 663, in format
    record.message = record.getMessage()
  File "/home/younes_huggingface_co/miniconda3/envs/fix-test/lib/python3.9/logging/__init__.py", line 367, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting

Because logger.warning does take a second positional argument

I also realised we should use warnings.warn to be in line with deprecation warning guildelines presented here: #26527 🤯

cc @amyeroberts

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops - my bad for not catching. Thanks for fixing!

@younesbelkada
Copy link
Contributor Author

Thanks ! That's on me as well :D

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@younesbelkada younesbelkada merged commit 6d1f545 into main Feb 15, 2024
21 checks passed
@younesbelkada younesbelkada deleted the younesbelkada-patch-1 branch February 15, 2024 14:33
hackyon pushed a commit to hackyon/transformers that referenced this pull request Feb 15, 2024
itazap pushed a commit that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants