Throw error when using attn_in with grouped query attention #810
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When using attn_in with models that use GroupedQueryAttention, TransformerLens crashes because use_attn_in does not account for the different number of query and key/value heads when using GQA. For models with GQA use_split_qkv_input should be used instead, because it implements hooks for query, key and value heads and therefore can account for the different number of heads for each of them. This PR implements a more meaningful error message that informs the user to use split_qkv_input when working with models with GQA instead of use_attn_in.
This PR is not linked to a specific issue.
After adding a test case, it failed because of a beartype error that stated that rotary_base needs to be an integer instead of a float. I adjusted this accordingly in the configuration of google/gemma-2b
Type of change
Checklist: