Commit 34a6c0a
Fix Flash Attention 3 API compatibility for window size parameters (NVIDIA#2704)
* Fix Flash Attention 3 API compatibility for window size parameters
Replace single window_size parameter with window_size_left and window_size_right
in flash_attn_fwd function to align with flash-attn v2.7.0+ API changes.
- Update function signature in flash_attn_interface
- Maintain backward compatibility where possible
- Ensure consistency with Flash Attention v2 implementation
Signed-off-by: Chaoyang Mei <1192554423@qq.com>
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
* Fix Flash Attention 3 backward API parameter naming
Rename causal parameter to is_causal in flash_attn_bwd function to align
with flash-attn v2.7.0+ API changes. This ensures consistency with the
updated flash-attn library interface for backward pass operations.
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
* Fix Flash Attention 3 backward API parameter naming
Rename causal parameter to is_causal in flash_attn_bwd function to align
with flash-attn v2.7.0+ API changes. This ensures consistency with the
updated flash-attn library interface for backward pass operations.
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Refactor Flash Attention 3 to use positional args instead of kwargs
Replace keyword arguments with positional arguments in flash_attn_fwd and
flash_attn_bwd to abstract away parameter naming differences (causal vs
is_causal) between flash-attn versions. This provides a more robust
interface that is resilient to future API changes in the flash-attn library.
- Convert window_size_left, window_size_right, and causal parameters to
positional args in both forward and backward functions
- Eliminate version-specific parameter naming dependencies
- Simplify compatibility handling across flash-attn v2.7.0+ variants
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
* Fix Flash Attention 3 backward API parameter naming
Rename causal parameter to is_causal in flash_attn_bwd function to align
with flash-attn v3 API changes. This ensures consistency with the
updated flash-attn library interface for backward pass operations.
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
---------
Signed-off-by: Chaoyang Mei <1192554423@qq.com>
Signed-off-by: meichaoyang001 <meichaoyang001@ke.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sudhakar Singh <sudhakars@nvidia.com>1 parent 6638fef commit 34a6c0a
1 file changed
Lines changed: 28 additions & 18 deletions
Lines changed: 28 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
940 | | - | |
| 940 | + | |
941 | 941 | | |
942 | | - | |
| 942 | + | |
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
| 1192 | + | |
1193 | 1193 | | |
1194 | | - | |
| 1194 | + | |
1195 | 1195 | | |
1196 | 1196 | | |
1197 | 1197 | | |
| |||
1201 | 1201 | | |
1202 | 1202 | | |
1203 | 1203 | | |
1204 | | - | |
| 1204 | + | |
1205 | 1205 | | |
1206 | | - | |
| 1206 | + | |
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
| |||
1225 | 1225 | | |
1226 | 1226 | | |
1227 | 1227 | | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1228 | 1232 | | |
1229 | 1233 | | |
1230 | 1234 | | |
| |||
1233 | 1237 | | |
1234 | 1238 | | |
1235 | 1239 | | |
1236 | | - | |
1237 | 1240 | | |
1238 | 1241 | | |
1239 | 1242 | | |
| |||
1508 | 1511 | | |
1509 | 1512 | | |
1510 | 1513 | | |
1511 | | - | |
| 1514 | + | |
| 1515 | + | |
1512 | 1516 | | |
1513 | 1517 | | |
1514 | 1518 | | |
| |||
2985 | 2989 | | |
2986 | 2990 | | |
2987 | 2991 | | |
2988 | | - | |
| 2992 | + | |
2989 | 2993 | | |
2990 | | - | |
| 2994 | + | |
2991 | 2995 | | |
2992 | 2996 | | |
2993 | 2997 | | |
| |||
3206 | 3210 | | |
3207 | 3211 | | |
3208 | 3212 | | |
3209 | | - | |
3210 | | - | |
3211 | | - | |
| 3213 | + | |
3212 | 3214 | | |
3213 | | - | |
| 3215 | + | |
3214 | 3216 | | |
3215 | 3217 | | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
3216 | 3222 | | |
3217 | 3223 | | |
3218 | 3224 | | |
| |||
3221 | 3227 | | |
3222 | 3228 | | |
3223 | 3229 | | |
3224 | | - | |
3225 | 3230 | | |
3226 | 3231 | | |
3227 | 3232 | | |
| |||
3361 | 3366 | | |
3362 | 3367 | | |
3363 | 3368 | | |
3364 | | - | |
| 3369 | + | |
| 3370 | + | |
3365 | 3371 | | |
3366 | 3372 | | |
3367 | 3373 | | |
| |||
3738 | 3744 | | |
3739 | 3745 | | |
3740 | 3746 | | |
3741 | | - | |
| 3747 | + | |
| 3748 | + | |
3742 | 3749 | | |
3743 | 3750 | | |
3744 | 3751 | | |
| |||
3821 | 3828 | | |
3822 | 3829 | | |
3823 | 3830 | | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
3824 | 3835 | | |
3825 | 3836 | | |
3826 | 3837 | | |
| |||
3829 | 3840 | | |
3830 | 3841 | | |
3831 | 3842 | | |
3832 | | - | |
3833 | 3843 | | |
3834 | 3844 | | |
3835 | 3845 | | |
| |||
0 commit comments