SAVRN
Search Contact SAVRN

Open-weight model · Text to image

SDXL-Lightning

by ByteDance ByteDance/SDXL-Lightning

SDXL-Lightning is a lightning-fast text-to-image generation model. It can generate high-quality 1024px images in a few steps. For more information, please refer to our research paper: SDXL-Lightning: Progressive Adversarial Diffusion Distillation.

Parameters
Context
Weights49.5 GB
Licenseopenrail++
AccessOpen weights
Monthly Downloads88.3k

Model Card

By ByteDance, published under openrail++, revision c9a24f48e1c0.

SDXL-Lightning is a lightning-fast text-to-image generation model. It can generate high-quality 1024px images in a few steps. For more information, please refer to our research paper: SDXL-Lightning: Progressive Adversarial Diffusion Distillation. We open-source the model as part of the research. Our models are distilled from stabilityai/stable-diffusion-xl-base-1.0. This repository contains checkpoints for 1-step, 2-step, 4-step, and 8-step distilled models. The generation quality of our 2-step, 4-step, and 8-step model is amazing. Our 1-step model is more experimental. We provide both full UNet and LoRA checkpoints. The full UNet models have the best quality while the LoRA models can be…

Read ByteDance's full model card

SDXL-Lightning is a lightning-fast text-to-image generation model. It can generate high-quality 1024px images in a few steps. For more information, please refer to our research paper: SDXL-Lightning: Progressive Adversarial Diffusion Distillation. We open-source the model as part of the research.

Our models are distilled from stabilityai/stable-diffusion-xl-base-1.0. This repository contains checkpoints for 1-step, 2-step, 4-step, and 8-step distilled models. The generation quality of our 2-step, 4-step, and 8-step model is amazing. Our 1-step model is more experimental.

We provide both full UNet and LoRA checkpoints. The full UNet models have the best quality while the LoRA models can be applied to other base models.

Demos

  • Generate with all configurations, best quality: Demo

Checkpoints

  • sdxl_lightning_Nstep.safetensors: All-in-one checkpoint, for ComfyUI.
  • sdxl_lightning_Nstep_unet.safetensors: UNet checkpoint only, for Diffusers.
  • sdxl_lightning_Nstep_lora.safetensors: LoRA checkpoint, for Diffusers and ComfyUI.

Diffusers Usage

Please always use the correct checkpoint for the corresponding inference steps.

2-Step, 4-Step, 8-Step UNet

import torch
from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file

base = "stabilityai/stable-diffusion-xl-base-1.0"
repo = "ByteDance/SDXL-Lightning"
ckpt = "sdxl_lightning_4step_unet.safetensors" # Use the correct ckpt for your step setting!

# Load model.
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")

# Ensure sampler uses "trailing" timesteps.
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")

# Ensure using the same inference steps as the loaded model and CFG set to 0.
pipe("A girl smiling", num_inference_steps=4, guidance_scale=0).images[0].save("output.png")

2-Step, 4-Step, 8-Step LoRA

Use LoRA only if you are using non-SDXL base models. Otherwise use our UNet checkpoint for better quality.

import torch
from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
from huggingface_hub import hf_hub_download

base = "stabilityai/stable-diffusion-xl-base-1.0"
repo = "ByteDance/SDXL-Lightning"
ckpt = "sdxl_lightning_4step_lora.safetensors" # Use the correct ckpt for your step setting!

# Load model.
pipe = StableDiffusionXLPipeline.from_pretrained(base, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.load_lora_weights(hf_hub_download(repo, ckpt))
pipe.fuse_lora()

# Ensure sampler uses "trailing" timesteps.
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")

# Ensure using the same inference steps as the loaded model and CFG set to 0.
pipe("A girl smiling", num_inference_steps=4, guidance_scale=0).images[0].save("output.png")

1-Step UNet

The 1-step model is only experimental and the quality is much less stable. Consider using the 2-step model for much better quality.

The 1-step model uses "sample" prediction instead of "epsilon" prediction! The scheduler needs to be configured correctly.

import torch
from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file

base = "stabilityai/stable-diffusion-xl-base-1.0"
repo = "ByteDance/SDXL-Lightning"
ckpt = "sdxl_lightning_1step_unet_x0.safetensors" # Use the correct ckpt for your step setting!

# Load model.
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")

# Ensure sampler uses "trailing" timesteps and "sample" prediction type.
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", prediction_type="sample")

# Ensure using the same inference steps as the loaded model and CFG set to 0.
pipe("A girl smiling", num_inference_steps=1, guidance_scale=0).images[0].save("output.png")

ComfyUI Usage

Please always use the correct checkpoint for the corresponding inference steps. Please use Euler sampler with sgm_uniform scheduler.

2-Step, 4-Step, 8-Step Full

  1. Download the full checkpoint (sdxl_lightning_Nstep.safetensors) to /ComfyUI/models/checkpoints.
  2. Download our ComfyUI full workflow.

2-Step, 4-Step, 8-Step LoRA

Use LoRA only if you are using non-SDXL base models. Otherwise use our full checkpoint for better quality.

  1. Prepare your own base model.
  2. Download the LoRA checkpoint (sdxl_lightning_Nstep_lora.safetensors) to /ComfyUI/models/loras
  3. Download our ComfyUI LoRA workflow.

1-Step

The 1-step model is only experimental and the quality is much less stable. Consider using the 2-step model for much better quality.

  1. Update your ComfyUI to the latest version.
  2. Download the full checkpoint (sdxl_lightning_1step_x0.safetensors) to /ComfyUI/models/checkpoints.
  3. Download our ComfyUI full 1-step workflow.

Cite Our Work

@misc{lin2024sdxllightning,
      title={SDXL-Lightning: Progressive Adversarial Diffusion Distillation}, 
      author={Shanchuan Lin and Anran Wang and Xiao Yang},
      year={2024},
      eprint={2402.13929},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Identity and Version

Repository
ByteDance/SDXL-Lightning
Publisher
ByteDance
Task
Text to image
Modality
Image
Library
diffusers
Parameters
Not stated by the source
Languages
Not stated by the source
Revision
c9a24f48e1c025556787b0c58dd67a091ece2e44
First published
2024-02-20
Last updated
2024-04-03

Files and Weights

22 files, 49.5 GB in total. The weights are 11 files totalling 49.5 GB in safetensors.

Weights11 files · 49.5 GB
Configuration3 files · 21.3 KB
Documentation2 files · 20.7 KB
Other5 files · 17.6 MB
Repository1 file · 1.6 KB
Every file
FileTypeSizeSHA-256
sdxl_lightning_1step_unet_x0.safetensorsWeights5.1 GB 14d53ad5b440
sdxl_lightning_1step_x0.safetensorsWeights6.9 GB dd8d4c2b341c
sdxl_lightning_2step.safetensorsWeights6.9 GB 87e61f60b85d
sdxl_lightning_2step_lora.safetensorsWeights393.9 MB 04fafc778385
sdxl_lightning_2step_unet.safetensorsWeights5.1 GB 15a96a3b213b
sdxl_lightning_4step.safetensorsWeights6.9 GB e0d996ee0013
sdxl_lightning_4step_lora.safetensorsWeights393.9 MB bf56cf2657ef
sdxl_lightning_4step_unet.safetensorsWeights5.1 GB 39a90a8a2a25
sdxl_lightning_8step.safetensorsWeights6.9 GB 43f0501ac4ff
sdxl_lightning_8step_lora.safetensorsWeights393.9 MB 5aa30d94cdf7
sdxl_lightning_8step_unet.safetensorsWeights5.1 GB 471d8260fda0
comfyui/sdxl_lightning_workflow_full.jsonConfiguration6.6 KB
comfyui/sdxl_lightning_workflow_full_1step.jsonConfiguration7.2 KB
comfyui/sdxl_lightning_workflow_lora.jsonConfiguration7.4 KB
LICENSE.mdDocumentation14.1 KB
README.mdDocumentation6.5 KB
comfyui/sdxl_lightning_workflow_full.jpgOther269.5 KB
comfyui/sdxl_lightning_workflow_full_1step.jpgOther285.3 KB
comfyui/sdxl_lightning_workflow_lora.jpgOther287.3 KB
sdxl_lightning_report.pdfOther16.5 MB 94bb9b70bd13
sdxl_lightning_samples.jpgOther300.3 KB
.gitattributesRepository1.6 KB

License and Download

License
openrail++
Access
Open weights, no gate
Download size
49.5 GB
Download from ByteDance

Released by ByteDance through its official repository on Hugging Face.

Built From

  • Described by arXiv:2402.13929

Memory Requirements

PrecisionWeights in memory
As published49.5 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About SDXL-Lightning

Can I use SDXL-Lightning commercially?

Yes, with conditions. SDXL-Lightning is released under Open RAIL++ License. Open RAIL++ permits use, including commercial use, subject to the use-based restrictions listed in the license, which must be passed on to downstream users.

Similar Models

Model · Text to image

Juggernaut-XL-v9

RunDiffusion

The SDXL ecosystem is the single most mature corner of open image generation, and v9 is its most refined photorealism checkpoint. Choose Juggernaut XL v9 when you want: - Photorealism that holds up under scrutiny — skin texture, micro-contrast, and natural lighting that translates from concept to print. - Reasonable hardware — runs comfortably on 8 GB of VRAM, unlike newer DiT-based models that demand 16+ GB. - The full SDXL toolbox — drop-in compatibility with the thousands of SDXL ControlNets, IP-Adapter variants, AnimateDiff, regional prompting tools, and LoRAs already in your workflow. - Battle-tested reliability — 26+ months in production, used in agencies, studios, and shipping…

Open weights creativeml-openrail-m diffusers

Model · Text to image

Qwen-Image-Lightning

Lightx2v

Please refer to Qwen-Image-Lightning github to learn how to use the models. make sure to install diffusers from main (pip install git+https://github.com/huggingface/diffusers.git)

Open weights apache-2.0 diffusers

Model · Text to image

Z-Image-Lora

nphSi

+ Always use full LoRa name with "vrtlxxxx" trigger in prompt like "Alba Baptista (vrtlalbabaptista) in a swimming pool". "Woman" or "1girl" will NOT work due to my way i do captions. + Add the gender to the prompt for confusing names like "Alex Jones". + Remove the name when internal model knowledge is bad or censored or is confusing to model like "Sandy Cheeks" or "Kate Middleton". + When using a Lora with multiple triggers (vrtlxx,vrtlyy) do not use the real character name but only trigger or a combination of it. "vrtlMain" always combines all trigger-words. Angourie Rice, January Jones, Julianna Guill, Ursula Corbero, Judith Rakers, Alina Merkau, Kiernan Shipka, Leslie Bibb, Marie…

Open weights apache-2.0 diffusers

Model · Text to image

Flux2-Klein-9B-True-V2

Wikee Yang

Recommend smthemex/ComfyUIUniBlockSwap plugin for LOW VRAM users, it only requires 4-6GB of VRAM to run the full bf16 model. 您可以尝试一下全新的 ComfyUI GGUF 模型加载插件 smthemex/ComfyUIDifGGUF,它能适配更多的 GGUF 文件格式,并且将很快集成低显存(4-8GB)显卡的 GGUF 模型块卸载管理能力。 Recommend to try the new GGUF ComfyUI loader plugin, smthemex/ComfyUIDifGGUF, it compatible with more GGUF format, and will add low VRAM (4-8GB) management for GGUF soon. 1. 图像的真实感和质感进一步改善,基本接近香蕉(Nano Banana)的水平。 2. 提示词遵循和还原能力,参数适配性和LoRA兼容性进一步改善,。 The V2 version of this model has undergone a full fine-tuning based on FLUX.2-Klein-9B-True-V1. Compared to the V1 version, it has some improvements and enhancements as below: 1. The realism and texture of images…

Open weights other diffusers

Model · Text to image

Z-Image-Turbo-GGUF

Unsloth AI

Welcome to the official repository for the Z-Image(造相)project! Z-Image is a powerful and highly efficient image generation model with 6B parameters. Currently there are three variants: - Z-Image-Turbo – A distilled version of Z-Image that matches or exceeds leading competitors with only 8 NFEs (Number of Function Evaluations). It offers sub-second inference latency on enterprise-grade H800 GPUs and fits comfortably within 16G VRAM consumer devices. It excels in photorealistic image generation, bilingual text rendering (English & Chinese), and robust instruction adherence. - Z-Image-Base – The non-distilled foundation model. By releasing this checkpoint, we aim to unlock the full potential…

Open weights apache-2.0 ggml

Model · Text to image

FLUX.1-dev-gguf

City

This is a direct GGUF conversion of black-forest-labs/FLUX.1-dev As this is a quantized model not a finetune, all the same restrictions/original license terms still apply. The model files can be used with the ComfyUI-GGUF custom node. Place model files in ComfyUI/models/unet - see the GitHub readme for further install instructions. Please refer to this chart for a basic overview of quantization types.

Open weights other gguf