You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support separate placement for encoding and decoding with tensor parallelism #15336
The tensor-parallel inference example from #13718 loads and runs the text encoders and VAE on every rank. Each rank encodes the same prompt and decodes the same final latents. For FLUX.1-schnell, those components account for about 9.3 GiB of bf16 weights per rank.
Could Diffusers support running encoding and decoding once per request, with configurable placement for those stages?
Encode the prompt and any input images once, then send the conditioning tensors to the TP group.
Run denoising across the TP group.
Decode and postprocess the final latents once.
Keeping the encoders and VAE on a single TP rank would reduce total memory use and redundant computation. If those weights stay resident during denoising, that rank still has less room for its denoiser shard. With equal-sized shards, the rank with the least free memory determines what fits across the group. To free memory on every TP rank during denoising, the pipeline could place encoding and decoding on a separate device or offload their weights between stages.
This came up while testing on Trainium, but the placement is hardware-independent. FLUX already accepts precomputed prompt embeddings and can return latents. Pipeline-level support would let callers use those stage boundaries without wiring them up separately for each pipeline.
Activity
DN6 commentedon Nov 18, 2026
@dacorvo Looking into it for
diffusers-cli serve#15017. Might not land in that PR, but should be included shortly after.