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

[stateless-llm]Query num_key_value_heads when available to support GQA models. #388

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

raikonenfnu
Copy link
Member

Models with GQA implemented would not have the same number of heads for K,V vs Query. Hence we need to query num_key_value_heads attribute to see if we require different value for KV cache size.

Not all model has num_key_value_heads as a part of their config such as QWEN. Phi has it, but it is set to null, hence the code is structured this way to handle those cases.

Copy link
Contributor

@IanNod IanNod left a comment

Choose a reason for hiding this comment

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

Looks good to me

Models with GQA implemented would not have the same number of heads for
K,V vs Query. Hence we need to query `num_key_value_heads` attribute to
see if we require different value for KV cache size.

Not all model has `num_key_value_heads` as a part of their config such as QWEN.
Phi has it, but it is set to null, hence the code is structured this way
to handle those cases.
@IanNod IanNod merged commit 4c42076 into main Feb 6, 2024
4 checks passed
@IanNod IanNod deleted the gqaSupport branch February 6, 2024 18:31
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.

2 participants