-
Notifications
You must be signed in to change notification settings - Fork 0
feat: flashv2 #94
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
base: main
Are you sure you want to change the base?
feat: flashv2 #94
Conversation
Probably small performance increase is because we use custom attention masks |
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.
we'd also probably wanna add a corresponding branch to https://github.com/yaak-ai/carGPT/blob/main/cargpt/components/llm.py#L229 (for attention viz at inference time)
cargpt/components/__init__.py
Outdated
@@ -3,6 +3,8 @@ | |||
from tensordict.tensorclass import _eq, _getitem # noqa: PLC2701 | |||
from tensordict.utils import IndexType | |||
|
|||
from cargpt.utils.attention import MemoryEfficientScaledDotProduct # noqa #type: ignore |
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.
do we actually need this exported here?
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.
We need to import it somewhere, so I find __init__.py
the best choice
So let's just merge it without viz feature. Can still be used at full grown training after experimenting stage is completed (never) |
Add flash attention v2
Basically, just extracted flash specific changes from https://github.com/yaak-ai/carGPT/tree/xformers-flashv2
Tested and it demonstrated running speed improvements: mean duration of train/val step (they are pretty similar) dropped by ~15% (1.9 -> 1.6 s)