Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/transformers/integrations/flash_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ def flash_attention_forward(
target_dtype=target_dtype,
attn_implementation=module.config._attn_implementation,
layer_idx=module.layer_idx if hasattr(module, "layer_idx") else None,
s_aux=s_aux.to(query.dtype), # FA only accepts half precision
s_aux=(
s_aux.to(query.dtype) # FA only accepts half precision
if s_aux is not None
else None
),
**kwargs,
)

Expand Down
Loading