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

Pass attn_implementation when using AutoXXX.from_config #30507

Conversation

amyeroberts
Copy link
Collaborator

@amyeroberts amyeroberts commented Apr 26, 2024

What does this PR do?

Passes attn_implementation=config._attn_implementation when creating a model using AutoXxx.from_config. This ensures the attention implementation selected is complementary with the parent model.

Not added for some models, as the default attn implementation selected for the model isn't compatible with the component model c.f. a57b9b5

If this is not passed, then breaking changes can occur when the attention implementation in the component model being loaded changes -- see #30506 for an example of breaking changes.

For example, when SDPA was added to BERT, this attention mechanism was then selected by default. This however wasn't supported by other models using it as an encoder.

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

@amyeroberts amyeroberts removed the request for review from younesbelkada April 26, 2024 17:57
Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Makes sense ! Thanks a lot for the investigation and fix ! 🚀

@amyeroberts amyeroberts merged commit e8acb70 into huggingface:main Apr 29, 2024
20 checks passed
@amyeroberts amyeroberts deleted the pass-attn-implementation-for-auto-model branch April 29, 2024 09:22
@VictorSanh
Copy link
Contributor

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