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: num_logits_to_keep in composite models #33168

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

zucchini-nlp
Copy link
Member

What does this PR do?

Fixes issue from #33164 (comment).

We cannot assume that the model will have num_logits_to_keep in its forward, because an LM can be used as backbone in composite models. So the current PR sets num_logits_to_keep to None by default and adds it as a kwarg only when it is explicitly set to an integer by users

Plus, updated VLMs accordingly with num_logits_to_keep. Other VLMs like BLIP don't need this arg because they delegate the whole generation process to the LM.

cc @merveenoyan

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

Understood, thanks @zucchini-nlp!

@LysandreJik
Copy link
Member

Would it be possible to add a test to ensure no regression on the issue #33164 (comment) ?

@zucchini-nlp
Copy link
Member Author

Oh, also cc @gante for generation :)

@zucchini-nlp
Copy link
Member Author

@LysandreJik yes, I am working on enabling generation tests on all VLMs. That should be 2-3 PRs away, after we fix some issues after the latest refactoring on VLM processing code

We've overlooked many issues on VLM side due to the absence of fast generation tests and slow tests are usually not ran if modeling code is unchanged.

@zucchini-nlp zucchini-nlp merged commit 7ed9789 into huggingface:main Sep 3, 2024
22 checks passed
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.

3 participants