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

🚨Deprecate legacy argument for image-text-to-text models and adopt new behavior by default #36307

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

yonigozlan
Copy link
Member

What does this PR do?

The legacy kwarg, behavior and the corresponding warnings have been out in the library for a while. The original deprecation version was 5.0.0, but as it is causing issues with remote_code models such as #36106 amongst others, it might be time to remove it now?
Other issue, the kwarg was removed from the image-text-to-text pipeline (inadvertently by me 😐) where it should be set to False by default, so right now the behavior in the pipeline for model that do use the legacy argument is not as it should be.
The models using the legacy kwarg are the following: Donut, Git, Pix2Struct.
They are quite old models, and hopefully users have had the time to see the deprecation warnings, but putting 🚨 as it will still change some default behaviors.

Comment on lines -126 to -128
if not legacy:
data["input_ids"] = data["input_ids"][:, :-1]
data["attention_mask"] = data["attention_mask"][:, :-1]
Copy link
Member Author

Choose a reason for hiding this comment

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

This was used to remove the SEP token at the end of prompts, as it was done in the inference example on the model card. However, it doesn't seem to have a big influence on the outputs, so I revert this back to its original behavior (before legacy was introduced)

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

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.

2 participants