Support separate placement for encoding and decoding with tensor parallelism

Aperta
#15,336 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@DN6 ci sta già lavorando.

Dal 18/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Python
Stelle
34.9k
Fork
7.5k
Merge medio
3g 16h
PR unite (30g)
65

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di huggingface/diffusers

Tutte le issue di huggingface/diffusers

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.