eDMD: Endpoint Distribution Matching for Few-Step Diffusion Distillation
Paper • 2611.17194 • Published • 1
How to use zttzzt/eDMD with Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", dtype=torch.bfloat16, device_map="cuda")
pipe.load_lora_weights("zttzzt/eDMD")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]4-step students of three text-to-image teachers, as LoRA. Paper: arXiv:2611.17194. Code: Westlake-AGI-Lab/eDMD.
| Directory | Base model | HPSv3++ (DrawBench-1000) | License |
|---|---|---|---|
sd3_medium/ |
stabilityai/stable-diffusion-3-medium-diffusers | 11.17 | Stability AI Non-Commercial Research Community License |
flux2_klein_4b/ |
black-forest-labs/FLUX.2-klein-base-4B | 12.70 | Apache 2.0 |
flux2_klein_9b/ |
black-forest-labs/FLUX.2-klein-base-9B | 12.43 | FLUX Non-Commercial License |
Each directory holds the LoRA (edmd_<directory>_lora.safetensors) with its teacher's license (LICENSE.md).
import torch
from diffusers import Flux2KleinPipeline
pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-4B", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("zttzzt/eDMD", subfolder="flux2_klein_4b", weight_name="edmd_flux2_klein_4b_lora.safetensors")
pipe.to("cuda")
image = pipe("a red fox in fresh snow, morning light", num_inference_steps=4, guidance_scale=1.0).images[0]
The students sample in 4 steps without guidance, on their teacher's grid:
| Directory | Pipeline | Call |
|---|---|---|
sd3_medium/ |
StableDiffusion3Pipeline |
num_inference_steps=4, sigmas=[1.0, 0.75, 0.5, 0.25], guidance_scale=1.0 |
flux2_klein_4b/, flux2_klein_9b/ |
Flux2KleinPipeline |
num_inference_steps=4, guidance_scale=1.0 |
python scripts/infer.py --weights zttzzt/eDMD/flux2_klein_4b/edmd_flux2_klein_4b_lora.safetensors --prompt "a red fox in fresh snow"
Each file's metadata carries the student's sampler (steps, grid, size), which the eDMD code reads for sampling and
for the paper's evaluation (python -m edmd.cli.evaluate generate --checkpoint <file> --eval drawbench1k ...).
Base model
black-forest-labs/FLUX.2-klein-base-4B