--- license: other license_name: per-directory license_link: LICENSE.md base_model: - stabilityai/stable-diffusion-3-medium-diffusers - black-forest-labs/FLUX.2-klein-base-4B - black-forest-labs/FLUX.2-klein-base-9B base_model_relation: adapter library_name: diffusers pipeline_tag: text-to-image tags: - lora - text-to-image - distillation - few-step --- # eDMD: Endpoint Distribution Matching for Few-Step Diffusion Distillation ![teaser](https://huggingface.co/zttzzt/eDMD/resolve/main/assets/teaser.jpg) 4-step students of three text-to-image teachers, as LoRA. Paper: [arXiv:2611.17194](https://arxiv.org/abs/2611.17194). Code: [Westlake-AGI-Lab/eDMD](https://github.com/Westlake-AGI-Lab/eDMD). | Directory | Base model | HPSv3++ (DrawBench-1000) | License | |---|---|---|---| | [`sd3_medium/`](sd3_medium) | [stabilityai/stable-diffusion-3-medium-diffusers](https://huggingface.co/stabilityai/stable-diffusion-3-medium-diffusers) | 11.17 | Stability AI Non-Commercial Research Community License | | [`flux2_klein_4b/`](flux2_klein_4b) | [black-forest-labs/FLUX.2-klein-base-4B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B) | 12.70 | Apache 2.0 | | [`flux2_klein_9b/`](flux2_klein_9b) | [black-forest-labs/FLUX.2-klein-base-9B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) | 12.43 | FLUX Non-Commercial License | Each directory holds the LoRA (`edmd__lora.safetensors`) with its teacher's license ([`LICENSE.md`](LICENSE.md)). ## Diffusers ```python 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` | ## With the eDMD code ```bash 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 --eval drawbench1k ...`).