-
Notifications
You must be signed in to change notification settings - Fork 29
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
enable softcap and gemma2 #288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter warnings are due to attn_func always being called with the softcap parameter, but not all implementations support it.
Per the other comments please see to only using this parameter on the models that require it
@@ -218,12 +218,6 @@ def decode_metadata(self) -> Optional["ROCmFlashAttentionMetadata"]: | |||
max_encoder_seq_len=self.max_encoder_seq_len, | |||
cross_slot_mapping=self.cross_slot_mapping, | |||
cross_block_tables=self.cross_block_tables) | |||
# Batch may be composed of prefill|decodes, adjust query start indices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this section being removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry... this is accident... it has been restored.
|
||
if logits_soft_cap is None: | ||
# In flash-attn, setting logits_soft_cap as 0 means no soft cap. | ||
logits_soft_cap = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effectively enables logits_soft_cap for any model, unconditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In flash attention, it is 0 by default, I think. https://github.com/ROCm/flash-attention/blob/main/flash_attn/flash_attn_interface.py#L1334
@@ -511,6 +515,11 @@ def __init__( | |||
self.use_naive_attn = True | |||
|
|||
if self.use_naive_attn: | |||
if logits_soft_cap is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make sure it's not None in the constructor. So naive flash attention can never be used now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed. thanks.
Gemma2 model needs softcap feature from flash attention.