Downloads ยท 30 days
695
4% of all-time downloads
RED-AIGC/TDD
TDD is a text-to-image model from RED-AIGC. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
Downloads ยท 30 days
695
4% of all-time downloads
All-time downloads
16.8K
Public
Repo size
4.9 GB
Likes
37
Public
Click a slice to open those files.
.safetensors3 GB ยท 100%
From the Hugging Face model README
Project Page | Paper | Code | Model | ๐ค TDD-SDXL Demo | ๐ค SVD-TDD Demo | ๐ค FLUX-TDD Demo
</div>Target-Driven Distillation: Consistency Distillation with Target Timestep Selection and Decoupled Guidance
<div align="center"> <img src="assets/teaser.jpg" alt="teaser" style="zoom:80%;" />Samples generated by TDD-distilled SDXL, with only 4--8 steps.
</div>from huggingface_hub import hf_hub_download
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights(hf_hub_download("RED-AIGC/TDD", "FLUX.1-dev_tdd_adv_lora_weights.safetensors"))
pipe.fuse_lora(lora_scale=0.125)
pipe.to("cuda")
image_flux = pipe(
prompt=[prompt],
generator=torch.Generator().manual_seed(int(3413)),
num_inference_steps=8,
guidance_scale=2.0,
height=1024,
width=1024,
max_sequence_length=256
).images[0]
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")
Thanks to Yamer and SG_161222 for developing YamerMIX and RealVisXL V4.0 respectively.
Target-Driven Distillation (TDD) features three key designs, that differ from previous consistency distillation methods.
An overview of TDD. (a) The training process features target timestep selection and decoupled guidance. (b) The inference process can optionally adopt non-equidistant denoising schedules.
</div> <div align="center"> <img src="assets/compare.png" alt="comparison" style="zoom:80%;" />Samples generated by SDXL models distilled by mainstream consistency distillation methods LCM, PCM, TCD, and our TDD, from the same seeds. Our method demonstrates advantages in both image complexity and clarity.
</div> <div align="center"> <img src="assets/other_1.jpg" alt="other"/>Samples generated by TDD-distilled different base models, and by SDXL with different LoRA adapters or ControlNets.
</div> <div align="center"> <video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/668767587bc84f3fe658fada/y7_uIXQOWK8AywASxcvbU.mp4"></video>Video samples generated by AnimateLCM-distilled (top) and TDD-distilled (bottom) SVD-xt 1.1, also with 4--8 steps.
</div>