keras-team/keras · error · RuntimeError

Require at least Ampere arch to run

Error message

Require at least Ampere arch to run

What it means

Raised in the JAX flash-attention capability check (_can_use_flash_attention, used by dot_product_attention). After confirming a CUDA GPU, the code probes the cuDNN version and requires compute capability >= 8.0 (NVIDIA Ampere or newer) for the flash-attention kernels; older GPUs hit this error when flash attention is requested/autoselected.

Solutions

  1. Disable flash attention: pass flash_attention=False to the attention op/layer so the XLA fallback kernel is used
  2. Run on an Ampere-or-newer GPU (compute capability >= 8.0) or on TPU, where flash attention is supported
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at keras/src/backend/jax/nn.py:1487 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/26b8616bed12948d. Report an issue: GitHub.

Appendix: source

Thrown at keras/src/backend/jax/nn.py:1487

        from jax.nn import dot_product_attention as dot_product_attention
    except ImportError:
        if raise_error:
            raise ImportError(
                "Flash attention is not supported in your current JAX version. "
                "Please update it by following the official guide: "
                "https://jax.readthedocs.io/en/latest/installation.html"
            )
        return False

    if jax.devices()[0].platform == "tpu":
        return True
    try:
        # Check if cuDNN is installed and raise RuntimeError if cuDNN is not
        # detected
        cudnn_version = check_cudnn_version()
        # Only support at least Ampere
        if not check_compute_capability("8.0"):
            raise RuntimeError("Require at least Ampere arch to run")

        # Inspect inputs of `check_layout`
        check_layout_params = list(
            inspect.signature(check_layout).parameters.keys()
        )
        for known_param in ("query", "key", "value", "bias", "layout"):
            check_layout_params.remove(known_param)
        # Defaults to `None` when not specified.
        check_layout_kwargs = {key: None for key in check_layout_params}
        check_layout(
            query,
            key,
            value,
            bias,
            layout=_normalize_layout("BTNH"),
            **check_layout_kwargs,
        )

View on GitHub (pinned to 7a34a03db6)