Skip to content
프로젝트

소개

SDXS: 이미지 조건을 사용하는 실시간 1단계 잠재 확산 모델

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

SDXS: Real-Time One-Step Latent Diffusion Models with Image Conditions

Project Paper SDXS-512-0.9 SDXS-512-DreamShaper SDXS-512-DreamShaper-Anime SDXS-512-DreamShaper-Sketch SDXS-512-DreamShaper-Demo SDXS-512-DreamShaper-Anime-Demo SDXS-512-DreamShaper-Sketch-Demo

Yuda Song, Zehao Sun, Xuanwu Yin

We present two models, SDXS-512 and SDXS-1024, achieving inference speeds of approximately 100 FPS (30x faster than SD v1.5) and 30 FPS (60x faster than SDXL) on a single GPU. Assuming the image generation time is limited to 1 second, then SDXL can only use 16 NFEs to produce a slightly blurry image, while SDXS-1024 can generate 30 clear images.

Moreover, our proposed method can also train ControlNet, offering promising applications in image-conditioned control and facilitating efficient image-to-image translation.

🔥News

⚡️Demo

Create a new environment:

conda create -n sdxs

Activate the new environment:

conda activate sdxs

Install requirements:

conda install python=3.10 pytorch=2.2.1 torchvision torchaudio pytorch-cuda=11.8 xformers=0.0.25 -c pytorch -c nvidia -c xformers
pip install -r requirements.txt

Run text-to-image demo:

python demo.py

Run anime-style text-to-image (LoRA) demo:

python demo_anime.py

Run sketch-to-image (ControlNet) demo:

python demo_sketch.py

💡Train

I found that DMD2 release the training code, and its training scheme is identical to the new version of SDXS, so you can refer to it. Unfortunately, the SDXS training code is not allowed to be open-sourced and will most likely not be updated again.

✒️Method

Model Acceleration

We train an extremely light-weight image decoder to mimic the original VAE decoder’s output through a combination of output distillation loss and GAN loss. We also leverage the block removal distillation strategy to efficiently transfer the knowledge from the original U-Net to a more compact version.

SDXS demonstrates efficiency far surpassing that of the base models, even achieving image generation at 100 FPS for 512x512 images and 30 FPS for 1024x1024 images on the GPU.

Text-to-Image

To reduce the NFEs, we suggest straightening the sampling trajectory and quickly finetuning the multi-step model into a one-step model by replacing the distillation loss function with the proposed feature matching loss. Then, we extend the Diff-Instruct training strategy, using the gradient of the proposed feature matching loss to replace the gradient provided by score distillation in the latter half of the timestep.

Despite a noticeable downsizing in both the sizes of the models and the number of sampling steps required, the prompt-following capability of SDXS-512 remains superior to that of SD v1.5. This observation is consistently validated in the performance of SDXS-1024 as well.

Image-to-Image

We extend our proposed training strategy to the training of ControlNet, relying on adding the pretrained ControlNet to the score function.

We demonstrate its efficacy in facilitating image-to-image conversions utilizing ControlNet, specifically for transformations involving canny edges and depth maps.

Citation

If you find this work useful for your research, please cite our paper:

@article{song2024sdxs,
  author    = {Yuda Song, Zehao Sun, Xuanwu Yin},
  title     = {SDXS: Real-Time One-Step Latent Diffusion Models with Image Conditions},
  journal   = {arxiv},
  year      = {2024},
}

Acknowledgment: the demo code is based on https://github.com/GaParmar/img2img-turbo.

관련 프로젝트 살펴보기

불러오는 중…