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

How to get attention score? "return_attn_probs=True" is not work. #1357

Closed
UnableToUseGit opened this issue Nov 25, 2024 · 1 comment
Closed

Comments

@UnableToUseGit
Copy link

version: flash-attn 2.7.0.post2

When I use the function "flash_attn_func" and I set return_attn_probs=True, it not returns a correct S_dmask

code:

attn_output, softmax_lse, S_dmask = flash_attn_func(query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal, return_attn_probs=True)
print(S_dmask)
>> tensor([], device='cuda:0', dtype=torch.float16)
@tridao
Copy link
Contributor

tridao commented Nov 25, 2024

As the docstring says, it's for testing only.

        return_attn_probs: bool. Whether to return the attention probabilities. This option is for
           testing only. The returned probabilities are not guaranteed to be correct
           (they might not have the right scaling).

In fact for dropout=0.0 we will return None.

@tridao tridao closed this as completed Dec 4, 2024
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

No branches or pull requests

2 participants