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

LLaVA: latency issues #34460

Merged
merged 4 commits into from
Oct 29, 2024
Merged

Conversation

zucchini-nlp
Copy link
Member

What does this PR do?

Fixes latency issues in some llava models caused by the recent processing logic refactoring. It was reported by one of the users that the new release is twice slower than the prev release. The problem was in indentation where images were embedded in every run instead of only the pre-fill stage

I believe it is worth fixing and merging until #33424 is merged to unblock e from updating hub configs and enabling the new logic

@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
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, noting that this is needed in a patch 🤗

Comment on lines -1113 to -1122
if input_ids is not None:
img_token_not_enough = (input_ids == self.config.image_token_index).sum(
1
).max() < self.config.image_seq_length
video_token_not_enough = (input_ids == self.config.video_token_index).sum(
1
).max() < self.config.video_seq_length
legacy_processing = (img_token_not_enough and pixel_values is not None) or (
video_token_not_enough and pixel_values_videos is not None
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

glad that this is removed, never saw this being added (was not pinged on the PR!)

@zucchini-nlp zucchini-nlp merged commit fe76b60 into huggingface:main Oct 29, 2024
17 checks passed
ArthurZucker pushed a commit that referenced this pull request Oct 29, 2024
* fix llavas

* code style

* green ci
@jiqing-feng
Copy link
Contributor

Hi @zucchini-nlp @ArthurZucker . This PR could lead the issue #34696 . Do you mind take a look? Thanks.

@zucchini-nlp
Copy link
Member Author

zucchini-nlp commented Nov 15, 2024

@jiqing-feng I'll be updating all model configs starting next week to enable the new logic for processing. So we stop seeing bugs related to the old logic maintenance. For the linked issue, will take a look soon , thanks

2015aroras pushed a commit to 2015aroras/transformers that referenced this pull request Nov 15, 2024
* fix llavas

* code style

* green ci
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* fix llavas

* code style

* green ci
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
* fix llavas

* code style

* green ci
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