Support separate placement for encoding and decoding with tensor parallelism

Offen
#15,336 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@DN6 arbeitet bereits daran.

Seit 18.11.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
34.9k
Forks
7.5k
Ø Merge
3 T. 16 Std.
Gemergte PRs (30 T.)
65

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus huggingface/diffusers

Alle Issues in huggingface/diffusers

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.