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

Generate: throw warning when return_dict_in_generate is False but should be True #33146

Merged
merged 4 commits into from
Aug 31, 2024

Conversation

gante
Copy link
Member

@gante gante commented Aug 27, 2024

What does this PR do?

See title.

I've fallen victim to this one a few times, so it probably means users have fallen too :)

@gante gante requested a review from LysandreJik August 27, 2024 14:32
@@ -786,7 +798,8 @@ def save_pretrained(

if use_auth_token is not None:
warnings.warn(
"The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.",
"The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. "
Copy link
Member Author

Choose a reason for hiding this comment

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

(>120 chars/line)

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks, saw a few related issue !

Comment on lines 735 to 740
if getattr(self, extra_output_flag) is True:
warnings.warn(
f"`return_dict_in_generate` is NOT set to `True`, but `{extra_output_flag}` is. When "
f"`return_dict_in_generate` is not `True`, `{extra_output_flag}` will not be respected.",
UserWarning,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

yep good catch!

@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.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Indeed, nice! LGTM, thanks @gante

@gante gante force-pushed the deprecate_return_dict branch from f93cf14 to fce676b Compare August 31, 2024 09:29
@gante gante merged commit eb5b968 into huggingface:main Aug 31, 2024
23 checks passed
@gante gante deleted the deprecate_return_dict branch August 31, 2024 09:47
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 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.

4 participants