[diffusion] chore: enforce component attention backend application (#36907)

This commit is contained in:
Mick
2026-08-31 14:00:02 +08:00
committed by GitHub
parent 28690f5aa5
commit 62c470697e
12 changed files with 408 additions and 83 deletions
+1 -1
View File
@@ -429,7 +429,7 @@ sglang generate \
--component-attention-backends text_encoder=torch_sdpa
```
The component key must match a pipeline module key such as `text_encoder`, `text_encoder_2`, `transformer`, `transformer_2`, or `connectors`. Component overrides take precedence over the global `--attention-backend` only while that component is being constructed and otherwise fail if the component cannot satisfy them. Sparse self-attention backends use a compatible dense backend for cross-attention layers. The global backend remains strict for DiT components, while auxiliary components may fall back to a compatible backend.
The component key must match a pipeline module key such as `text_encoder`, `text_encoder_2`, `transformer`, `transformer_2`, or `connectors`. Component overrides take precedence over the global `--attention-backend` while that component is being constructed and fail if the component cannot satisfy them. A native component may explicitly defer backend selection until first use; components with fixed attention reject the override. Sparse self-attention backends use a compatible dense backend for cross-attention layers. The global backend remains strict for DiT components, while auxiliary components may fall back to a compatible backend. The Diffusers backend supports only the global backend passthrough.
You can also pass dotted CLI entries:
@@ -642,6 +642,10 @@ Use this override when the fallback must be pinned: unlike the global backend,
an incompatible component override raises an error instead of selecting another
backend. The one role-based exception is a sparse self-attention backend, which
uses a compatible dense backend for cross-attention layers in the same component.
The component must construct SGLang-selectable attention or explicitly defer
selection until first use; components with fixed attention reject the override.
Per-component overrides apply only to native pipelines. The Diffusers backend
accepts the global `--attention-backend` passthrough instead.
### Per-request override (denoise loop)