模型介绍
内容详情
替代品
模型简介
Hyper-SD是最新的扩散模型加速技术之一,通过LoRA和蒸馏技术实现快速高质量的图像生成。
模型特点
高效推理
支持1步到16步的快速推理,显著提升生成速度。
多模型兼容
兼容FLUX.1-dev、SD3、SDXL和SD1.5等多种基础模型。
高质量生成
即使在极少的推理步数下,仍能保持高质量的图像生成效果。
灵活配置
支持LoRA缩放比例和引导尺度的灵活调整,以适应不同需求。
模型能力
文本生成图像
快速推理
高质量图像生成
多模型兼容
使用案例
创意设计
快速概念设计
设计师可以快速生成多种概念草图,加速创意过程。
在1-8步内生成高质量概念图
内容创作
社交媒体内容生成
快速生成适合社交媒体的视觉内容。
高效生成多样化视觉素材
library_name: diffusers inference: false tags:
- lora
- 文生图
- stable-diffusion
- flux base_model: black-forest-labs/FLUX.1-dev
Hyper-SD
论文*Hyper-SD*的官方仓库。
项目主页:https://hyper-sd.github.io/
最新动态🔥🔥🔥
- 2024年8月26日。💥💥💥 我们发布了适用于FLUX.1-dev相关模型的8步和16步LoRA!推荐LoRA缩放系数约为0.125(与训练自适应),引导尺度可保持在3.5。更低步数的LoRA即将推出。💥💥💥
- 2024年8月19日。SD3相关的CFG LoRA现已可用!推荐在4/8/16步时设置引导尺度为3.0/5.0/7.0。使用diffusers推理前,别忘了以较小比例(如0.125,与训练自适应)融合lora。注意8步和16步LoRA也可分别在稍少步数(如6步和12步)下推理。期待您的反馈,FLUX相关模型将于下周推出。
- 2024年5月13日。12步CFG保留的Hyper-SDXL-12steps-CFG-LoRA和Hyper-SD15-12steps-CFG-LoRA现已可用(支持5~8引导尺度),这在性能和速度之间提供了更好的平衡,更实用。尽情享受吧!
- 2024年4月30日。我们的8步CFG保留Hyper-SDXL-8steps-CFG-LoRA和Hyper-SD15-8steps-CFG-LoRA现已可用(支持5~8引导尺度),强烈建议将8步CFGLora作为所有SDXL和SD15模型的标准配置!!!
- 2024年4月28日。使用TCDScheduler在不同步数下推理的1步统一LoRA 🥰的ComfyUI工作流已发布!记得在
ComfyUI/custom_nodes
文件夹中安装⭕️ ComfyUI-TCD!!!鼓励调整eta参数以获得更好效果🌟! - 2024年4月26日。感谢@Pete为我们的涂鸦演示贡献了更大的画布👏。
- 2024年4月24日。1步SDXL UNet的ComfyUI工作流和检查点✨也已可用!别忘了⭕️在
ComfyUI/custom_nodes
文件夹中安装自定义调度器!!! - 2024年4月23日。N步LoRA的ComfyUI工作流已发布!创作者们值得一试💥!
- 2024年4月23日。我们的技术报告📚已上传至arXiv!提供了许多实现细节,欢迎更多讨论👏。
- 2024年4月21日。Hyper-SD ⚡️高度兼容,可与不同基础模型和controlnets良好配合。为澄清,我们还在此处添加了controlnet的使用示例。
- 2024年4月20日。我们的检查点和两个演示🤗(即SD15-Scribble和SDXL-T2I)已在HuggingFace仓库公开。
试试我们的Hugging Face演示:
Hyper-SD涂鸦演示托管于🤗 scribble
Hyper-SDXL一步文生图演示托管于🤗 T2I
介绍
Hyper-SD是最新的扩散模型加速技术之一。 在本仓库中,我们发布了从FLUX.1-dev、SD3-Medium、SDXL Base 1.0和Stable-Diffusion v1-5蒸馏出的模型。
检查点
Hyper-FLUX.1-dev-Nsteps-lora.safetensors
: LoRA检查点,适用于FLUX.1-dev相关模型。Hyper-SD3-Nsteps-CFG-lora.safetensors
: LoRA检查点,适用于SD3相关模型。Hyper-SDXL-Nstep-lora.safetensors
: LoRA检查点,适用于SDXL相关模型。Hyper-SD15-Nstep-lora.safetensors
: LoRA检查点,适用于SD1.5相关模型。Hyper-SDXL-1step-unet.safetensors
: 从SDXL-Base蒸馏出的Unet检查点。
文生图使用
FLUX.1-dev相关模型
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"
# 以8步lora为例
ckpt_name = "Hyper-FLUX.1-dev-8steps-lora.safetensors"
# 加载模型,请填写您的访问令牌,因为FLUX.1-dev仓库是受控模型。
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="一张猫的照片", num_inference_steps=8, guidance_scale=3.5).images[0]
image.save("output.png")
SD3相关模型
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"
# 以8步lora为例
ckpt_name = "Hyper-SD3-8steps-CFG-lora.safetensors"
# 加载模型,请填写您的访问令牌,因为SD3仓库是受控模型。
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="一张猫的照片", num_inference_steps=8, guidance_scale=5.0).images[0]
image.save("output.png")
SDXL相关模型
2步、4步、8步LoRA
以2步LoRA为例,您也可以使用其他LoRA进行相应推理步数设置。
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"
# 以2步lora为例
ckpt_name = "Hyper-SDXL-2steps-lora.safetensors"
# 加载模型。
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()
# 确保ddim调度器时间步间距设置为trailing!!!
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
# 较低的eta会带来更多细节
prompt="一张猫的照片"
image=pipe(prompt=prompt, num_inference_steps=2, guidance_scale=0).images[0]
统一LoRA(支持1到8步推理)
您可以灵活调整推理步数和eta值以获得最佳性能。
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"
# 加载模型。
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()
# 使用TCD调度器以获得更好的图像质量
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
# 较低的eta在多步推理中会带来更多细节
eta=1.0
prompt="一张猫的照片"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, eta=eta).images[0]
1步SDXL Unet
仅适用于单步推理。
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"
# 加载模型。
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")
# 使用LCM调度器而非ddim调度器以支持特定的时间步输入
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
# 在一步推理中将起始时间步设置为800以获得更好结果
prompt="一张猫的照片"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, timesteps=[800]).images[0]
SD1.5相关模型
2步、4步、8步LoRA
以2步LoRA为例,您也可以使用其他LoRA进行相应推理步数设置。
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"
# 以2步lora为例
ckpt_name = "Hyper-SD15-2steps-lora.safetensors"
# 加载模型。
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()
# 确保ddim调度器时间步间距设置为trailing!!!
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
prompt="一张猫的照片"
image=pipe(prompt=prompt, num_inference_steps=2, guidance_scale=0).images[0]
统一LoRA(支持1到8步推理)
您可以灵活调整推理步数和eta值以获得最佳性能。
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"
# 加载模型。
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()
# 使用TCD调度器以获得更好的图像质量
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
# 较低的eta在多步推理中会带来更多细节
eta=1.0
prompt="一张猫的照片"
image=pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0, eta=eta).images[0]
ControlNet使用
SDXL相关模型
2步、4步、8步LoRA
以Canny Controlnet和2步推理为例:
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
# 加载原始图像
image = load_image("https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/hf-logo.png")
image = np.array(image)
# 准备Canny控制图像
low_threshold = 100
high_threshold = 200
image = cv2.Canny(image, low_threshold, high_threshold)
image = image[:, :, None]
image = np.concatenate([image, image, image], axis=2)
control_image = Image.fromarray(image)
control_image.save("control.png")
control_weight = 0.5 # 推荐以获得良好泛化性
# 初始化管道
controlnet = ControlNetModel.from_pretrained(
"diffusers/controlnet-canny-sdxl-1.0",
torch_dtype=torch.float16
)
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", controlnet=controlnet, vae=vae, torch_dtype=torch.float16).to("cuda")
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-SDXL-2steps-lora.safetensors"))
# 确保ddim调度器时间步间距设置为trailing!!!
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
pipe.fuse_lora()
image = pipe("一块巧克力饼干", num_inference_steps=2, image=control_image, guidance_scale=0, controlnet_conditioning_scale=control_weight).images[0]
image.save('image_out.png')
统一LoRA(支持1到8步推理)
以Canny Controlnet为例:
import torch
from diffusers.utils import load_image
import numpy as np
import cv2
from PIL import Image
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL, TCDScheduler
from huggingface_hub import hf_hub_download
# 加载原始图像
image = load_image("https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/hf-logo.png")
image = np.array(image)
# 准备Canny控制图像
low_threshold = 100
high_threshold = 200
image = cv2.Canny(image, low_threshold, high_threshold)
image = image[:, :, None]
image = np.concatenate([image, image, image], axis=2)
control_image = Image.fromarray(image)
control_image.save("control.png")
control_weight = 0.5
Stable Diffusion V1 5
Openrail
稳定扩散是一种潜在的文本到图像扩散模型,能够根据任何文本输入生成逼真的图像。
图像生成
S
stable-diffusion-v1-5
3.7M
518
Stable Diffusion Inpainting
Openrail
基于稳定扩散的文本到图像生成模型,具备图像修复能力
图像生成
S
stable-diffusion-v1-5
3.3M
56
Stable Diffusion Xl Base 1.0
SDXL 1.0是基于扩散的文本生成图像模型,采用专家集成的潜在扩散流程,支持高分辨率图像生成
图像生成
S
stabilityai
2.4M
6,545
Stable Diffusion V1 4
Openrail
稳定扩散是一种潜在文本到图像扩散模型,能够根据任意文本输入生成逼真图像。
图像生成
S
CompVis
1.7M
6,778
Stable Diffusion Xl Refiner 1.0
SD-XL 1.0优化器模型是Stability AI开发的图像生成模型,专为提升SDXL基础模型生成的图像质量而设计,特别擅长最终去噪步骤处理。
图像生成
S
stabilityai
1.1M
1,882
Stable Diffusion 2 1
基于扩散的文本生成图像模型,支持通过文本提示生成和修改图像
图像生成
S
stabilityai
948.75k
3,966
Stable Diffusion Xl 1.0 Inpainting 0.1
基于Stable Diffusion XL的潜在文本到图像扩散模型,具备通过遮罩进行图像修复的功能
图像生成
S
diffusers
673.14k
334
Stable Diffusion 2 Base
基于扩散的文生图模型,可根据文本提示生成高质量图像
图像生成
S
stabilityai
613.60k
349
Playground V2.5 1024px Aesthetic
其他
开源文生图模型,能生成1024x1024分辨率及多种纵横比的美学图像,在美学质量上处于开源领域领先地位。
图像生成
P
playgroundai
554.94k
723
Sd Turbo
SD-Turbo是一款高速文本生成图像模型,仅需单次网络推理即可根据文本提示生成逼真图像。
图像生成
S
stabilityai
502.82k
380
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers

支持多种语言
L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers

英语
C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统
中文
R
uer
2,694
98
AIbase是一个专注于MCP服务的平台,为AI开发者提供高质量的模型上下文协议服务,助力AI应用开发。
简体中文