keras-team/keras · error · ValueError

Dropout is not supported when flash attention is enabled. Pl

Error message

Dropout is not supported when flash attention is enabled. Please set dropout to 0.0 to use flash attention.

What it means

Error "Dropout is not supported when flash attention is enabled. Please set dropout to 0.0 to use flash attention." thrown in keras-team/keras.

Source

Thrown at keras/src/layers/attention/multi_head_attention.py:205

                "`attention_axes` must be an int, list, or tuple."
                f"Received: attention_axes={attention_axes}"
            )
        self._attention_axes = attention_axes
        if sliding_window is not None and (
            not isinstance(sliding_window, int) or sliding_window <= 0
        ):
            raise ValueError(
                "`sliding_window` must be `None` or a positive integer. "
                f"Received: sliding_window={sliding_window}"
            )
        self._sliding_window = sliding_window
        self.seed = seed

        self._inverse_sqrt_key_dim = 1.0 / math.sqrt(float(self._key_dim))

        # Check for flash attention constraints
        if self._flash_attention and self._dropout > 0.0:
            raise ValueError(
                "Dropout is not supported when flash attention is enabled. "
                "Please set dropout to 0.0 to use flash attention."
            )

    @property
    def num_heads(self):
        return self._num_heads

    @property
    def key_dim(self):
        return self._key_dim

    @property
    def value_dim(self):
        return self._value_dim

    @property
    def dropout(self):

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/layers/attention/multi_head_attention.py:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25). Data as JSON: /api/errors/378742b13bec2954. Report an issue: GitHub.