Instructions to use ByteDance/SDXL-Lightning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ByteDance/SDXL-Lightning with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ByteDance/SDXL-Lightning", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Update ComfyUI workflow
Browse filesFiles changed (10)
- README.md+13-8
- comfyui/sdxl_lightning_workflow_full.jpgAdded
- comfyui/sdxl_lightning_unet.json → comfyui/sdxl_lightning_workflow_full.jsonRenamed+83-113
- comfyui/sdxl_lightning_workflow_full_1step.jpgAdded
- comfyui/sdxl_lightning_workflow_full_1step.jsonAdded+444
- comfyui/sdxl_lightning_workflow_lora.jpgAdded
- comfyui/sdxl_lightning_lora.json → comfyui/sdxl_lightning_workflow_lora.jsonRenamed+103-103
- images/comfyui_lora.pngDeleted
- images/comfyui_unet.pngDeleted
- images/intro.jpg → sdxl_lightning_samples.jpgRenamed
7 unmodified lines89101112131488 unmodified lines1031041051061071081091101111121131141151161171181191207 unmodified lines# SDXL-LightningSDXL-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 paper: [SDXL-Lightning: Progressive Adversarial Diffusion Distillation](https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_report.pdf). The models are released for research purposes only.88 unmodified lines### 2-Step, 4-Step, 8-Step UNet1. Download the UNet checkpoint to `/ComfyUI/models/unet`.2. Download our [ComfyUI UNet workflow](comfyui/sdxl_lightning_unet.json).### 2-Step, 4-Step, 8-Step LoRA1. Download the LoRA checkpoint to `/ComfyUI/models/loras`2. Download our [ComfyUI LoRA workflow](comfyui/sdxl_lightning_lora.json).### 1-Step UNetComfyUI does not support changing the model formulation to x0-prediction, so it is not usable in ComfyUI yet. Hopefully, ComfyUI will get updated soon.7 unmodified lines89101112131488 unmodified lines1031041051061071081091101111121131141151161171181191201211221231241257 unmodified lines# SDXL-LightningSDXL-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 paper: [SDXL-Lightning: Progressive Adversarial Diffusion Distillation](https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_report.pdf). The models are released for research purposes only.88 unmodified lines### 2-Step, 4-Step, 8-Step UNet1. Download the full checkpoint (`sdxl_lightning_Nstep.safetensors`) to `/ComfyUI/models/checkpoints`.1. Download our [ComfyUI full workflow](comfyui/sdxl_lightning_workflow_full.json).### 2-Step, 4-Step, 8-Step LoRA1. Prepare your own base model.1. Download the LoRA checkpoint (`sdxl_lightning_Nstep_lora.safetensors`) to `/ComfyUI/models/loras`1. Download our [ComfyUI LoRA workflow](comfyui/sdxl_lightning_workflow_lora.json).### 1-Step UNet1. Update your ComfyUI to the latest version.1. Download the full checkpoint (`sdxl_lightning_1step_x0.safetensors`) to `/ComfyUI/models/checkpoints`.1. Download our [ComfyUI full 1-step workflow](comfyui/sdxl_lightning_workflow_full_1step.json).
1234567 unmodified lines1415161718192033 unmodified lines5455565758596031 unmodified lines9293949596979864 unmodified lines1631641651661671681697 unmodified lines1771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272286 unmodified lines2352362372382392402414 unmodified lines2462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053066 unmodified lines31331431531631731831932032132232332432525 unmodified lines3513523533543553563571 unmodified line35936036136236336462 unmodified lines427428429430431432433434{"last_node_id": 14,"last_link_id": 14,"nodes": [{"id": 8,7 unmodified lines"1": 46},"flags": {},"order": 8,"mode": 0,"inputs": [{33 unmodified lines"1": 180.6060791015625},"flags": {},"order": 6,"mode": 0,"inputs": [{31 unmodified lines"1": 164.31304931640625},"flags": {},"order": 5,"mode": 0,"inputs": [{64 unmodified lines"1": 270},"flags": {},"order": 9,"mode": 0,"inputs": [{7 unmodified lines"ComfyUI"]},{"id": 4,"type": "CheckpointLoaderSimple","pos": [45,192],"size": {"0": 315,"1": 98},"flags": {},"order": 1,"mode": 0,"outputs": [{"name": "MODEL","type": "MODEL","links": [],"slot_index": 0},{"name": "CLIP","type": "CLIP","links": [3,5],"slot_index": 1},{"name": "VAE","type": "VAE","links": [8],"slot_index": 2}],"properties": {"Node name for S&R": "CheckpointLoaderSimple"},"widgets_values": ["sdxl_base_1.0.safetensors"]},{"id": 12,"type": "Note",6 unmodified lines"1": 59.37213134765625},"flags": {},"order": 2,"mode": 0,"properties": {"text": ""4 unmodified lines"color": "#432","bgcolor": "#653"},{"id": 13,"type": "Note","pos": [861,72],"size": {"0": 315.6669921875,"1": 58},"flags": {},"order": 3,"mode": 0,"properties": {"text": ""},"widgets_values": ["Euler sampler with sgm_uniform is the default."],"color": "#432","bgcolor": "#653"},{"id": 14,"type": "UNETLoader","pos": [44,344],"size": {"0": 315,"1": 58},"flags": {},"order": 4,"mode": 0,"outputs": [{"name": "MODEL","type": "MODEL","links": [14],"shape": 3,"slot_index": 0}],"properties": {"Node name for S&R": "UNETLoader"},"widgets_values": ["sdxl_lightning_4step_unet.pth"]},{"id": 3,"type": "KSampler",6 unmodified lines"1": 262},"flags": {},"order": 7,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 14},{"name": "positive",25 unmodified lines"Node name for S&R": "KSampler"},"widgets_values": [43158134645665,"randomize",4,1,1 unmodified line"sgm_uniform",1]}],"links": [62 unmodified lines"IMAGE"],[14,14,0,3,0,1234567 unmodified lines1415161718192033 unmodified lines5455565758596031 unmodified lines9293949596979864 unmodified lines1631641651661671681697 unmodified lines1771781791801811826 unmodified lines1891901911921931941954 unmodified lines2002012022032042056 unmodified lines21221321421521621721821922022122222322425 unmodified lines2502512522532542552561 unmodified line25825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333462 unmodified lines397398399400401402403404{"last_node_id": 13,"last_link_id": 13,"nodes": [{"id": 8,7 unmodified lines"1": 46},"flags": {},"order": 7,"mode": 0,"inputs": [{33 unmodified lines"1": 180.6060791015625},"flags": {},"order": 5,"mode": 0,"inputs": [{31 unmodified lines"1": 164.31304931640625},"flags": {},"order": 4,"mode": 0,"inputs": [{64 unmodified lines"1": 270},"flags": {},"order": 8,"mode": 0,"inputs": [{7 unmodified lines"ComfyUI"]},{"id": 12,"type": "Note",6 unmodified lines"1": 59.37213134765625},"flags": {},"order": 1,"mode": 0,"properties": {"text": ""4 unmodified lines"color": "#432","bgcolor": "#653"},{"id": 3,"type": "KSampler",6 unmodified lines"1": 262},"flags": {},"order": 6,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 13},{"name": "positive",25 unmodified lines"Node name for S&R": "KSampler"},"widgets_values": [777803651532148,"randomize",4,1,1 unmodified line"sgm_uniform",1]},{"id": 13,"type": "Note","pos": [861,72],"size": {"0": 315.6669921875,"1": 58},"flags": {},"order": 2,"mode": 0,"properties": {"text": ""},"widgets_values": ["Use Euler sampler with sgm_uniform.\nCFG 1 is the fastest."],"color": "#432","bgcolor": "#653"},{"id": 4,"type": "CheckpointLoaderSimple","pos": [45,192],"size": {"0": 315,"1": 98},"flags": {},"order": 3,"mode": 0,"outputs": [{"name": "MODEL","type": "MODEL","links": [13],"slot_index": 0},{"name": "CLIP","type": "CLIP","links": [3,5],"slot_index": 1},{"name": "VAE","type": "VAE","links": [8],"slot_index": 2}],"properties": {"Node name for S&R": "CheckpointLoaderSimple"},"widgets_values": ["sdxl_lightning_4step.safetensors"]}],"links": [62 unmodified lines"IMAGE"],[13,4,0,3,0,
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444{ "last_node_id": 11, "last_link_id": 12, "nodes": [ { "id": 7, "type": "CLIPTextEncode", "pos": [ 413, 389 ], "size": { "0": 425.27801513671875, "1": 180.6060791015625 }, "flags": {}, "order": 5, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 5 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [ 6 ], "slot_index": 0 } ], "properties": { "Node name for S&R": "CLIPTextEncode" }, "widgets_values": [ "text, watermark" ] }, { "id": 6, "type": "CLIPTextEncode", "pos": [ 415, 186 ], "size": { "0": 422.84503173828125, "1": 164.31304931640625 }, "flags": {}, "order": 4, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 3 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [ 4 ], "slot_index": 0 } ], "properties": { "Node name for S&R": "CLIPTextEncode" }, "widgets_values": [ "beautiful scenery nature glass bottle landscape, , purple galaxy bottle," ] }, { "id": 8, "type": "VAEDecode", "pos": [ 1209, 188 ], "size": { "0": 210, "1": 46 }, "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "samples", "type": "LATENT", "link": 7 }, { "name": "vae", "type": "VAE", "link": 8 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 9 ], "slot_index": 0 } ], "properties": { "Node name for S&R": "VAEDecode" } }, { "id": 5, "type": "EmptyLatentImage", "pos": [ 473, 609 ], "size": { "0": 315, "1": 106 }, "flags": {}, "order": 0, "mode": 0, "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [ 2 ], "slot_index": 0 } ], "properties": { "Node name for S&R": "EmptyLatentImage" }, "widgets_values": [ 1024, 1024, 1 ] }, { "id": 10, "type": "UNETLoader", "pos": [ -25.932962590997874, 20.977972550825626 ], "size": { "0": 315, "1": 58 }, "flags": {}, "order": 1, "mode": 0, "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [ 11 ], "shape": 3, "slot_index": 0 } ], "properties": { "Node name for S&R": "UNETLoader" }, "widgets_values": [ "sdxl_lightning_1step_unet_x0.pth" ] }, { "id": 9, "type": "SaveImage", "pos": [ 1451, 189 ], "size": [ 592.1579173694956, 641.068880254572 ], "flags": {}, "order": 8, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 9 } ], "properties": {}, "widgets_values": [ "ComfyUI" ] }, { "id": 11, "type": "ModelSamplingDiscrete", "pos": [ 456, -27 ], "size": { "0": 315, "1": 82 }, "flags": {}, "order": 3, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 11 } ], "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [ 12 ], "shape": 3, "slot_index": 0 } ], "properties": { "Node name for S&R": "ModelSamplingDiscrete" }, "widgets_values": [ "x0", false ] }, { "id": 3, "type": "KSampler", "pos": [ 863, 186 ], "size": { "0": 315, "1": 262 }, "flags": {}, "order": 6, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 12 }, { "name": "positive", "type": "CONDITIONING", "link": 4 }, { "name": "negative", "type": "CONDITIONING", "link": 6 }, { "name": "latent_image", "type": "LATENT", "link": 2 } ], "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [ 7 ], "slot_index": 0 } ], "properties": { "Node name for S&R": "KSampler" }, "widgets_values": [ 156680208700286, "fixed", 1, 1, "euler", "simple", 1 ] }, { "id": 4, "type": "CheckpointLoaderSimple", "pos": [ -123, 291 ], "size": { "0": 315, "1": 98 }, "flags": {}, "order": 2, "mode": 0, "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [], "slot_index": 0 }, { "name": "CLIP", "type": "CLIP", "links": [ 3, 5 ], "slot_index": 1 }, { "name": "VAE", "type": "VAE", "links": [ 8 ], "slot_index": 2 } ], "properties": { "Node name for S&R": "CheckpointLoaderSimple" }, "widgets_values": [ "sd_xl_1.0.safetensors" ] } ], "links": [ [ 2, 5, 0, 3, 3, "LATENT" ], [ 3, 4, 1, 6, 0, "CLIP" ], [ 4, 6, 0, 3, 1, "CONDITIONING" ], [ 5, 4, 1, 7, 0, "CLIP" ], [ 6, 7, 0, 3, 2, "CONDITIONING" ], [ 7, 3, 0, 8, 0, "LATENT" ], [ 8, 4, 2, 8, 1, "VAE" ], [ 9, 8, 0, 9, 0, "IMAGE" ], [ 11, 10, 0, 11, 0, "MODEL" ], [ 12, 11, 0, 3, 0, "MODEL" ] ], "groups": [], "config": {}, "extra": {}, "version": 0.4}177 unmodified lines1781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802 unmodified lines283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373177 unmodified lines]},{"id": 4,"type": "CheckpointLoaderSimple","pos": [45,192],"size": {"0": 315,"1": 98},"flags": {},"order": 1,"mode": 0,"outputs": [{"name": "MODEL","type": "MODEL","links": [11],"slot_index": 0},{"name": "CLIP","type": "CLIP","links": [3,5],"slot_index": 1},{"name": "VAE","type": "VAE","links": [8],"slot_index": 2}],"properties": {"Node name for S&R": "CheckpointLoaderSimple"},"widgets_values": ["sdxl_base_1.0.safetensors"]},{"id": 11,"type": "LoraLoaderModelOnly","pos": [43,349],"size": {"0": 315,"1": 82},"flags": {},"order": 4,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 11}],"outputs": [{"name": "MODEL","type": "MODEL","links": [12],"shape": 3,"slot_index": 0}],"properties": {"Node name for S&R": "LoraLoaderModelOnly"},"widgets_values": ["sdxl_lightning_4step_lora.pth",1]},{"id": 12,"type": "Note","pos": [44,71],"size": {"0": 314.0921630859375,"1": 59.37213134765625},"flags": {},"order": 2,2 unmodified lines"text": ""},"widgets_values": ["Remember to use the correct checkpoint for your inference step setting!"],"color": "#432","bgcolor": "#653"},{"id": 13,"type": "Note","pos": [861,72],"size": {"0": 315.6669921875,"1": 58},"flags": {},"order": 3,"mode": 0,"properties": {"text": ""},"widgets_values": ["Euler sampler with sgm_uniform is the default."],"color": "#432","bgcolor": "#653"},{"id": 3,"type": "KSampler","pos": [863,186],"size": {"0": 315,"1": 262},"flags": {},"order": 7,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 12},{"name": "positive","type": "CONDITIONING","link": 4},{"name": "negative","type": "CONDITIONING","link": 6},{"name": "latent_image","type": "LATENT","link": 2}],"outputs": [{"name": "LATENT","type": "LATENT","links": [7],"slot_index": 0}],"properties": {"Node name for S&R": "KSampler"},"widgets_values": [683612750974907,"randomize",4,1,"euler","sgm_uniform",1]}],177 unmodified lines1781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742 unmodified lines277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373177 unmodified lines]},{"id": 12,"type": "Note","pos": [44,71],"size": {"0": 314.0921630859375,"1": 59.37213134765625},"flags": {},"order": 1,"mode": 0,"properties": {"text": ""},"widgets_values": ["Remember to use the correct checkpoint for your inference step setting!"],"color": "#432","bgcolor": "#653"},{"id": 3,"type": "KSampler","pos": [863,186],"size": {"0": 315,"1": 262},"flags": {},"order": 7,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 12},{"name": "positive","type": "CONDITIONING","link": 4},{"name": "negative","type": "CONDITIONING","link": 6},{"name": "latent_image","type": "LATENT","link": 2}],"outputs": [{"name": "LATENT","type": "LATENT","links": [7],"slot_index": 0}],"properties": {"Node name for S&R": "KSampler"},"widgets_values": [712589392390569,"randomize",4,1,"euler","sgm_uniform",1]},{"id": 13,"type": "Note","pos": [861,72],"size": {"0": 315.6669921875,"1": 58},"flags": {},"order": 2,2 unmodified lines"text": ""},"widgets_values": ["Use Euler sampler with sgm_uniform.\nCFG 1 is the fastest."],"color": "#432","bgcolor": "#653"},{"id": 11,"type": "LoraLoaderModelOnly","pos": [43,349],"size": {"0": 315,"1": 82},"flags": {},"order": 4,"mode": 0,"inputs": [{"name": "model","type": "MODEL","link": 11}],"outputs": [{"name": "MODEL","type": "MODEL","links": [12],"shape": 3,"slot_index": 0}],"properties": {"Node name for S&R": "LoraLoaderModelOnly"},"widgets_values": ["sdxl_lightning_4step_lora.safetensors",1]},{"id": 4,"type": "CheckpointLoaderSimple","pos": [45,192],"size": {"0": 315,"1": 98},"flags": {},"order": 3,"mode": 0,"outputs": [{"name": "MODEL","type": "MODEL","links": [11],"slot_index": 0},{"name": "CLIP","type": "CLIP","links": [3,5],"slot_index": 1},{"name": "VAE","type": "VAE","links": [8],"slot_index": 2}],"properties": {"Node name for S&R": "CheckpointLoaderSimple"},"widgets_values": ["sd_xl_base_1.0.safetensors"]}],
README.md+13-8
comfyui/sdxl_lightning_workflow_full.jpgAdded

comfyui/sdxl_lightning_unet.json → comfyui/sdxl_lightning_workflow_full.jsonRenamed+83-113
comfyui/sdxl_lightning_workflow_full_1step.jpgAdded

comfyui/sdxl_lightning_workflow_full_1step.jsonAdded+444
comfyui/sdxl_lightning_workflow_lora.jpgAdded

comfyui/sdxl_lightning_lora.json → comfyui/sdxl_lightning_workflow_lora.jsonRenamed+103-103
images/comfyui_lora.pngDeleted
images/comfyui_unet.pngDeleted
images/intro.jpg → sdxl_lightning_samples.jpgRenamed

