Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/layers/flash_attention.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ namespace ctranslate2 {

// init output
StorageView context(dtype, device);
ops::FlashAttention fl_attn_ops(_queries_scale, _sliding_window);
// Causal masking only applies to decoder self-attention; encoder
// self-attention must attend bidirectionally.
ops::FlashAttention fl_attn_ops(_queries_scale, _sliding_window, /*is_causal=*/_is_decoder);
fl_attn_ops(queries_proj, keys_proj, values_proj, context, cached_keys, cached_values, attention,
return_normalized_attention, rotary_cos, rotary_sin, rotary_interleaved, nullptr/*alibli*/, offset);

Expand Down
3 changes: 2 additions & 1 deletion src/layers/whisper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace ctranslate2 {
scope + "/layer",
_num_heads,
/*pre_norm=*/true,
ops::ActivationType::GELU))
ops::ActivationType::GELU,
model.use_flash_attention()))
, _output_norm(model, scope + "/layer_norm")
{
}
Expand Down
Loading