Skip to content

Update Pixtral to use SDPA - #34542

Closed
mgoin wants to merge 1 commit into
huggingface:mainfrom
mgoin:patch-3
Closed

mgoin wants to merge 1 commit into
huggingface:mainfrom
mgoin:patch-3

Conversation

@mgoin

@mgoin mgoin commented Oct 31, 2024 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes large memory consumption and performance issues with unfused attention in Pixtral. The usage comes from the vLLM implementation in vllm-project/vllm#9597

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@Rocketknight1

Copy link
Copy Markdown
Member

cc @zucchini-nlp - should we keep the eager implementation around as well rather than making SDPA the only option?

@zucchini-nlp zucchini-nlp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mgoin cool, thanks for adding thsi! Yes, lets add SDPA as another option and run the tests (including slow) to make sure everything works. We'll also need to set the _supports_sdpa flag to True so it can dispatch to it by default

@ArthurZucker

Copy link
Copy Markdown
Collaborator

Thanks for this! Pixtral now goes through the shared attention interface, which already provides SDPA (and other backends), so hand-wired SDPA calls in the model file aren't needed anymore. Closing, thank you!

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