Official Repository of the paper: Hyper-SD.
Fuente del modelo
Descripción de la fuente
Official Repository of the paper: Hyper-SD.
Project Page: https://hyper-sd.github.io/
Fuentes
1 fuenteVerificado 30 sept
Artefactos del modelo
19 artefactosExtractos de fuentes
2 extractosComfyUI/custom_nodes folder!!! You're encouraged to adjust the eta parameter to get better results 🌟!ComfyUI/custom_nodes folder!!!Hyper-SD Scribble demo host on 🤗 scribble
Hyper-SDXL One-step Text-to-Image demo host on 🤗 T2I
Hyper-SD is one of the new State-of-the-Art diffusion model acceleration techniques. In this repository, we release the models distilled from FLUX.1-dev, SD3-Medium, SDXL Base 1.0 and Stable-Diffusion v1-5。
Hyper-FLUX.1-dev-Nsteps-lora.safetensors: Lora checkpoint, for FLUX.1-dev-related models.Hyper-SD3-Nsteps-CFG-lora.safetensors: Lora checkpoint, for SD3-related models.Hyper-SDXL-Nstep-lora.safetensors: Lora checkpoint, for SDXL-related models.Hyper-SD15-Nstep-lora.safetensors: Lora checkpoint, for SD1.5-related models.Hyper-SDXL-1step-unet.safetensors: Unet checkpoint distilled from SDXL-Base.import torch
from diffusers import FluxPipeline
from huggingface_hub import hf_hub_download
base_model_id = "black-forest-labs/FLUX.1-dev"
repo_name = "ByteDance/Hyper-SD"
# Take 8-steps lora as an example
ckpt_name = "Hyper-FLUX.1-dev-8steps-lora.safetensors"
# Load model, please fill in your access tokens since FLUX.1-dev repo is a gated model.
pipe = FluxPipeline.from_pretrained(base_model_id, token="xxx")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora(lora_scale=0.125)
pipe.to("cuda", dtype=torch.float16)
image=pipe(prompt="a photo of a cat", num_inference_steps=8, guidance_scale=3.5).images[0]
image.save("output.png")
import torch
from diffusers import StableDiffusion3Pipeline
from huggingface_hub import hf_hub_download
base_model_id = "stabilityai/stable-diffusion-3-medium-diffusers"
repo_name = "ByteDance/Hyper-SD"
# Take 8-steps lora as an example
ckpt_name = "Hyper-SD3-8steps-CFG-lora.safetensors"
# Load model, please fill in your access tokens since SD3 repo is a gated model.
pipe = StableDiffusion3Pipeline.from_pretrained(base_model_id, token="xxx")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora(lora_scale=0.125)
pipe.to("cuda", dtype=torch.float16)
image=pipe(prompt="a photo of a cat", num_inference_steps=8, guidance_scale=5.0).images[0]
image.save("output.png")
Take the 2-steps LoRA as an example, you can also use other LoRAs for the corresponding inference steps setting.
import torch
from diffusers import DiffusionPipeline, DDIMScheduler
from huggingface_hub import hf_hub_download
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
repo_name = "ByteDance/Hyper-SD"
# Take 2-steps lora as an example
ckpt_name = "Hyper-SDXL-2steps-lora.safetensors"
# Load model.
pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora()
# Ensure ddim scheduler timestep spacing set as trailing !!!
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
# lower eta results in more detail
prompt="a photo of a cat"
image=pipe(prompt=prompt, num_inference_steps=2, guidance_scale=0).images[0]
You can flexibly adjust the number of inference steps and eta value to achieve best performance.
import torch
from diffusers import DiffusionPipeline, TCDScheduler
from huggingface_hub import hf_hub_download
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
repo_name = "ByteDance/Hyper-SD"
ckpt_name = "Hyper-SDXL-1step-lora.safetensors"
# Load model.
pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora()
# Use TCD scheduler to achieve better image quality
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
# Lower eta results in more detail for multi-steps inference
eta=1.0
prompt="a photo of a cat"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, eta=eta).images[0]
Only for the single step inference.
import torch
from diffusers import DiffusionPipeline, UNet2DConditionModel, LCMScheduler
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
repo_name = "ByteDance/Hyper-SD"
ckpt_name = "Hyper-SDXL-1step-Unet.safetensors"
# Load model.
unet = UNet2DConditionModel.from_config(base_model_id, subfolder="unet").to("cuda", torch.float16)
unet.load_state_dict(load_file(hf_hub_download(repo_name, ckpt_name), device="cuda"))
pipe = DiffusionPipeline.from_pretrained(base_model_id, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
# Use LCM scheduler instead of ddim scheduler to support specific timestep number inputs
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
# Set start timesteps to 800 in the one-step inference to get better results
prompt="a photo of a cat"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, timesteps=[800]).images[0]
Take the 2-steps LoRA as an example, you can also use other LoRAs for the corresponding inference steps setting.
import torch
from diffusers import DiffusionPipeline, DDIMScheduler
from huggingface_hub import hf_hub_download
base_model_id = "runwayml/stable-diffusion-v1-5"
repo_name = "ByteDance/Hyper-SD"
# Take 2-steps lora as an example
ckpt_name = "Hyper-SD15-2steps-lora.safetensors"
# Load model.
pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora()
# Ensure ddim scheduler timestep spacing set as trailing !!!
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
prompt="a photo of a cat"
image=pipe(prompt=prompt, num_inference_steps=2, guidance_scale=0).images[0]
You can flexibly adjust the number of inference steps and eta value to achieve best performance.
import torch
from diffusers import DiffusionPipeline, TCDScheduler
from huggingface_hub import hf_hub_download
base_model_id = "runwayml/stable-diffusion-v1-5"
repo_name = "ByteDance/Hyper-SD"
ckpt_name = "Hyper-SD15-1step-lora.safetensors"
# Load model.
pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.load_lora_weights(hf_hub_download(repo_name, ckpt_name))
pipe.fuse_lora()
# Use TCD scheduler to achieve better image quality
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
# Lower eta results in more detail for multi-steps inference
eta=1.0
prompt="a photo of a cat"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, eta=eta).images[0]
Take Canny Controlnet and 2-steps inference as an example:
import torch
from diffusers.utils import load_image
import numpy as np
import cv2
from PIL import Image
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL, DDIMScheduler
from huggingface_hub import hf_hub_download
# Load original image
image = load_image("https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/hf-logo.png")
image = np.array(image)
# Prepare Canny Control Image
low_threshold = 100
high_threshold = 200
image = cv2.Canny(image, low_threshold, high_threshold)
image = image[:, :, None]
image =...
Hyper-SD15-12steps-CFG-lora.safetensors
safetensors · 257 MB · SHA-256 64b984373835…8361 · Hugging Face
Hyper-SD15-1step-lora.safetensors
safetensors · 257 MB · SHA-256 a04fd9a535c1…ca3b · Hugging Face
DescargarHyper-SD15-2steps-lora.safetensors
safetensors · 257 MB · SHA-256 2f26dcc1d883…8c3a · Hugging Face
DescargarHyper-SD15-4steps-lora.safetensors
safetensors · 257 MB · SHA-256 c5dd05861646…5958 · Hugging Face
DescargarHyper-SD15-8steps-CFG-lora.safetensors
safetensors · 257 MB · SHA-256 f6123d5b950d…e482 · Hugging Face
DescargarHyper-SD15-8steps-lora.safetensors
safetensors · 257 MB · SHA-256 91fc3186236e…cd13 · Hugging Face
DescargarHyper-SD3-16steps-CFG-lora.safetensors
safetensors · 450 MB · SHA-256 5b4d0b99d58d…6bc9 · Hugging Face
DescargarHyper-SD3-4steps-CFG-lora.safetensors
safetensors · 450 MB · SHA-256 0ee4e529abd1…1602 · Hugging Face
DescargarHyper-SD3-8steps-CFG-lora.safetensors
safetensors · 450 MB · SHA-256 fc6a3e73e14e…027e · Hugging Face
DescargarHyper-SDXL-12steps-CFG-lora.safetensors
safetensors · 751 MB · SHA-256 0b97f447b587…25b6 · Hugging Face
DescargarHyper-SDXL-1step-lora.safetensors
safetensors · 751 MB · SHA-256 c912df184c51…c78a · Hugging Face
DescargarHyper-SDXL-1step-Unet-Comfyui.fp16.safetensors
safetensors · 6,46 GB · SHA-256 f3bf72c28596…6592 · Hugging Face
DescargarHyper-SDXL-1step-Unet.safetensors
safetensors · 9,56 GB · SHA-256 3d72d3f97c08…2dd1 · Hugging Face
DescargarHyper-SDXL-2steps-lora.safetensors
safetensors · 751 MB · SHA-256 69b25c0187ce…5187 · Hugging Face
DescargarHyper-SDXL-4steps-lora.safetensors
safetensors · 751 MB · SHA-256 12f81a27d00a…d76e · Hugging Face
DescargarHyper-SDXL-8steps-CFG-lora.safetensors
safetensors · 751 MB · SHA-256 55b51334c850…19b1 · Hugging Face
DescargarHyper-SDXL-8steps-lora.safetensors
safetensors · 751 MB · SHA-256 ca689190e8c4…17c1 · Hugging Face
Descargar--- library_name: diffusers inference: false tags: - lora - text-to-image - stable-diffusion - flux base_model: black-forest-labs/FLUX.1-dev --- # Hyper-SD Official Repository of the paper: *[Hyper-SD](https://arxiv.org/abs/2404.13686)*. Project Page: https://hyper-sd.github.io/  ## News🔥🔥🔥 * Aug.26, 2024. 💥💥💥 Our 8-steps and 16-steps **FLUX.1-dev-related LoRAs** are available now! We recommend LoRA scales around 0.125 that is adaptive with training and guidance scale could be kept on 3.5. Lower step LoRAs would be coming soon. 💥💥💥 * Aug.19, 2024. SD3-related CFG LoRAs are available now! We recommend setting guidance scale to 3.0/5.0/7.0 at 4/8/16-steps. Don't forget to fuse lora with a relatively small scale (e.g. 0.125 that is adaptive with training) before inference with diffusers. Note that 8-steps and 16-steps LoRA can also inference on a little bit smaller steps like 6-steps and 12-steps, respectively. Hope to hear your feedback, FLUX-related models will be coming next week. * May.13, 2024. The 12-Steps CFG-Preserved [Hyper-SDXL-12steps-CFG-LoRA](https://huggingface.co/ByteDance/Hyper-SD/blob/main/Hyper-SDXL-12steps-CFG-lora.safetensors) and [Hyper-SD15-12steps-CFG-LoRA](https://huggingface.co/ByteDance/Hyper-SD/blob/main/Hyper-SD15-12steps-CFG-lora.safetensors) is also available now(support 5~8 guidance scales), this could be more practical with better trade-off between performance and speed. Enjoy! * Apr.30, 2024. Our 8-Steps CFG-Preserved [Hyper-SDXL-8steps-CFG-LoRA](https://huggingface.co/ByteDance/Hyper-SD/blob/main/Hyper-SDXL-8steps-CFG-lora.safetensors) and [Hyper-SD15-8steps-CFG-LoRA](https://huggingface.co/ByteDance/Hyper-SD/blob/main/Hyper-SD15-8steps-CFG-lora.safetensors) is available now(support 5~8 guidance scales), we strongly recommend making the 8-step CFGLora a standard configuration for all SDXL and SD15 models!!! * Apr.28, 2024. ComfyUI workflows on 1-Step Unified LoRA 🥰 with TCDScheduler to inference on different steps are [released](https://huggingface.co/ByteDance/Hyper-SD/tree/main/comfyui)! Remember to install ⭕️ [ComfyUI-TCD](https://github.com/JettHu/ComfyUI-TCD) in your `ComfyUI/custom_nodes` folder!!! You're encouraged to adjust the eta parameter to get better results 🌟! * Apr.26, 2024. Thanks to @[Pete](https://huggingface.co/pngwn) for contributing to our [scribble demo](https:/...
Source context: 67867 downloads · 1352 likes · Pipeline text-to-image · Library diffusers · Repo ByteDance/Hyper-SD