Add flashdreams.accelerated support for Wan recipe and LingBot integration - #541
Add flashdreams.accelerated support for Wan recipe and LingBot integration#541fangjunzhou-nv wants to merge 3 commits into
Conversation
Greptile SummaryThe PR adds accelerated self- and cross-attention adapters for Wan, wires hardware-tuned attention presets into LingBot, and introduces benchmark and plotting utilities.
Confidence Score: 4/5The optimized presets need a distributed-launch guard or context-parallel-compatible implementation before merging because multi-process LingBot startup currently fails. Both newly registered hardware presets select optimized self-attention, while the existing transformer initialization always forwards the distributed WORLD group for world sizes above one and the optimized implementation immediately rejects it. Files Needing Attention: integrations/lingbot/lingbot/config.py; flashdreams/flashdreams/recipes/wan/transformer/impl/modules.py Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[LingBot runner preset] --> B[Pipeline setup]
B --> C[Wan21Transformer]
C --> D[WanDiTNetwork]
D --> E{Attention backend}
E -->|Torch| F[Torch attention]
E -->|Optimized| G[Optimized Wan attention]
C --> H[Distributed WORLD group]
H --> G
G --> I[Rejects context parallelism]
Reviews (1): Last reviewed commit: "Added tunned runner config for LingBot o..." | Re-trigger Greptile |
| diffusion_model=dict( | ||
| transformer=dict( | ||
| network=dict( | ||
| self_attention_backend=AttentionBackend.OPTIMIZED, |
There was a problem hiding this comment.
Distributed optimized startup fails
If either new optimized preset runs with a distributed world size greater than one, Wan21Transformer forwards the WORLD context-parallel group to optimized self-attention, which rejects every non-None group and raises NotImplementedError before generation starts. Add an explicit single-rank constraint or use a context-parallel-compatible attention implementation.
Knowledge Base Used:
There was a problem hiding this comment.
Currently flashdreams.accelerated doesn't support context parallel and this is a KNOWN ISSUE. Please be aware this will be out side the scope of LingBot integration.
This PR brings flashdreams.accelerated OptimizedMultiHeadAttention to Wan family attention and use it in LingBot.
This PR should also serve as an example of how to use flashdreams.accelerated in a new integration.
Please note that the v2 runtime currently doesn't allow you to change the runner config. So you have to manually hard code it in
integrations_v2/cam2v_lingbot/cam2v_lingbot/app.pylike this: