-
Notifications
You must be signed in to change notification settings - Fork 114
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
Restore SDPA in Gemma2 models for transformers > 4.45 #976
Restore SDPA in Gemma2 models for transformers > 4.45 #976
Conversation
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. |
what about the issue huggingface/transformers#32848 which is the reason behind the default implementation change. Pretty sure it's a modeling incompatibility but can you make sure the snippet in the issue returns the correct outputs with sdpa+ov_model ? |
@IlyasMoutawwakil , I tested gemma-2-2b-it, output seems correct: ['Let's count them! \n\nYou've used the word "laugh" one times in your question. 😊 \n', 'There are two "laugh" words in your sentence. 😊 \n', 'There are three "laugh" words in the phrase "laugh laugh laugh". \n', 'There are four "laugh" words in the phrase "laugh laugh laugh laugh". \n', 'There are 5 "laugh" words in the phrase "laugh laugh laugh laugh laugh". \n'] P.S. as I understand issue appears for bfloat16 execution on cuda, that is not our case (even loading bf16 model weights in ov we try to preserve fp32 accuracy level and fallback nodes to this precision if there is overflow), there is difference from original answer due to difference in used cache format, but it does not impact meaning and I receive the same out if modify cache class for transfroemrs too |
thanks for investigating 👍 |
* Restore SDPA in Gemma2 models for transformers > 4.45 * Update tests/openvino/test_modeling.py * Update tests/openvino/test_modeling.py
What does this PR do?
transformers 4.45 introduces perf regression for gemma2 models due to switching default realization from sdpa to eager in this commit:
huggingface/transformers@975b988
benchmarking results for CPU:
Before submitting