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

attention's flop calculation when casual is set to True. #1033

Open
kf-zhang opened this issue Apr 22, 2024 · 2 comments
Open

attention's flop calculation when casual is set to True. #1033

kf-zhang opened this issue Apr 22, 2024 · 2 comments

Comments

@kf-zhang
Copy link

❓ Questions and Help

I'm currently trying to comprehend the attention flop calculation as defined here. However, I am facing confusion regarding this specific section, which pertains to the flop calculation when 'casual' is set to True. It seems that the flop is incorrect when query's length is different from key-value' s length.

@danthe3rd
Copy link
Contributor

It seems that the flop is incorrect when query's length is different from key-value' s length

Yes indeed, you are right.
I guess we also need to distinguish between causal from topleft / bottomright when num_kv != num_q. This is not passed in the API at the moment.
Out of curiosity, what are you using this function for?

@kf-zhang
Copy link
Author

I'm trying to calculate mfu and understand how flop is calculated. Many papers describe their system's efficiency using mfu, but few explain how to calculate flop.

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