-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add Flashmask #65409
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
Add Flashmask #65409
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
Sorry to inform you that 9c65da5's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
Sorry to inform you that efc5ce0's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
…ashmask_merging
): | ||
is_unpad = False | ||
else: | ||
is_unpad = bool( |
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.
LGTM, 当 flashmask 识别到是 varlen 的模式时,启用 varlen 的方式执行。
""" | ||
|
||
if window_size 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.
LGTM,当设置了 window_size 时,用 flashmask 直接构造 startend_row_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.
LGTM for yaml
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.
def flashmask_attention( | ||
query, | ||
key, | ||
value, | ||
startend_row_indices=None, | ||
*, | ||
dropout=0.0, | ||
causal=False, | ||
window_size=None, | ||
return_softmax_lse=False, | ||
return_seed_offset=False, | ||
fixed_seed_offset=None, | ||
rng_name="", | ||
training=True, | ||
name=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.
后续 PR 记得恢复并补齐新增参数的类型提示
ff33521
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.
LGTM
afcfcee
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.
LGTM for yaml
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.
LGTM
PR Category
Performance Optimization
PR Types
New features
Description
Pcard-70459
重命名
flash_attention_with_sparse_mask
为flashmask_attention
, 重命名参数并支持更复杂的mask跳过masked block的计算以改善性能