Text-to-Image
Diffusers
English
TDD / README.md
RedAIGC's picture
Update README.md
a802a86 verified
|
raw
history blame
2.17 kB
metadata
license: apache-2.0
language:
  - en
library_name: diffusers
pipeline_tag: text-to-image

Target-Driven Distillation

Introduction

Target-Driven Distillation: Consistency Distillation with Target Timestep Selection and Decoupled Guidance

Update

[2024.08.22]:Upload the TDD LoRA weights of Stable Diffusion XL, YamerMIX and RealVisXL-V4.0, fast text-to-image generation.

  • sdxl_tdd_lora_weights.safetensors
  • yamermix_tdd_lora_weights.safetensors
  • realvis_tdd_sdxl_lora_weights.safetensors

Thanks to Yamer and SG_161222 for developing YamerMIX and RealVisXL V4.0 respectively.

Usage

You can directly download the model in this repository. You also can download the model in python script:

from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="RedAIGC/TDD", filename="sdxl_tdd_lora_weights.safetensors", local_dir="./tdd_lora")
# !pip install opencv-python transformers accelerate 
import torch
import diffusers
from diffusers import StableDiffusionXLPipeline
from tdd_scheduler import TDDScheduler

device = "cuda"
tdd_lora_path = "tdd_lora/sdxl_tdd_lora_weights.safetensors"

pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16").to(device)

pipe.scheduler = TDDSchedulerPlus.from_config(pipe.scheduler.config)
pipe.load_lora_weights(tdd_lora_path, adapter_name="accelerate")
pipe.fuse_lora()

prompt = "A photo of a cat made of water."

image = pipe(
    prompt=prompt,
    num_inference_steps=4,
    guidance_scale=1.7,
    eta=0.2, 
    generator=torch.Generator(device=device).manual_seed(546237),
).images[0]

image.save("tdd.png")