[go: nahoru, domu]

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: handle text conditioning with multimodal encoder-decoder models #22748

Merged
merged 14 commits into from
Apr 13, 2023

Conversation

gante
Copy link
Member
@gante gante commented Apr 13, 2023

What does this PR do?

Consolidates decoder_input_ids preparation changes in a single place, for all future multimodal encoder-decoder models on PT and TF.

In a nutshell, this PR generalizes the following use cases:

  1. The user passes decoder_input_ids, but it is missing the BOS token (some tokenizers, like the T5 tokenizer, do not prepend a BOS token). In this case, a BOS token is prepended.
  2. The user passes input_ids, but the encoder has no input_ids input. In this case, input_ids is handled just like decoder_input_ids.

Slow tests were run on T5, Pix2Struct, BLIP, and BLIP2.

@gante gante requested a review from sgugger April 13, 2023 17:45
@gante
Copy link
Member Author
gante commented Apr 13, 2023

cc @younesbelkada @NielsRogge FYI -- this PR consolidates your recent changes regarding text conditioning on multimodal models. The next models should be easier to add :)

@HuggingFaceDocBuilderDev
Copy link
HuggingFaceDocBuilderDev commented Apr 13, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator
@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

@gante gante merged commit 9dfd6a4 into huggingface:main Apr 13, 2023
@gante gante deleted the img2text_decoder_input_ids branch April 13, 2023 18:51
@NielsRogge
Copy link
Contributor

Thanks a lot @gante! 🙏

novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
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.

None yet

4 participants