🚀 无访问限制的Stable Diffusion 3.5 Large Turbo!
本项目与原版功能一致,只是重新上传并移除了访问限制机制。它是一个文本到图像的生成模型,能够根据文本提示生成高质量的图像,在图像质量、排版、复杂提示理解和资源效率方面表现出色。

🚀 快速开始
若要使用该模型,可按照以下步骤操作:
- 升级到最新版本的 🧨 diffusers库
pip install -U diffusers
- 运行以下代码
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large-turbo", torch_dtype=torch.bfloat16)
pipe = pipe.to("cuda")
image = pipe(
"A capybara holding a sign that reads Hello Fast World",
num_inference_steps=4,
guidance_scale=0.0,
).images[0]
image.save("capybara.png")
✨ 主要特性
- 高质量图像生成:基于文本提示生成高质量的图像。
- 高效推理:采用Adversarial Diffusion Distillation (ADD)技术,可在4步采样内生成高质量图像。
- 多文本编码器:使用三种固定的预训练文本编码器,包括CLIPs和T5。
📦 安装指南
升级diffusers库
pip install -U diffusers
量化模型以减少VRAM使用
pip install bitsandbytes
💻 使用示例
基础用法
import torch
from diffusers import StableDiffusion3Pipeline
pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-large-turbo", torch_dtype=torch.bfloat16)
pipe = pipe.to("cuda")
image = pipe(
"A capybara holding a sign that reads Hello Fast World",
num_inference_steps=4,
guidance_scale=0.0,
).images[0]
image.save("capybara.png")
高级用法
from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
from diffusers import StableDiffusion3Pipeline
import torch
model_id = "stabilityai/stable-diffusion-3.5-large-turbo"
nf4_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model_nf4 = SD3Transformer2DModel.from_pretrained(
model_id,
subfolder="transformer",
quantization_config=nf4_config,
torch_dtype=torch.bfloat16
)
t5_nf4 = T5EncoderModel.from_pretrained("diffusers/t5-nf4", torch_dtype=torch.bfloat16)
pipeline = StableDiffusion3Pipeline.from_pretrained(
model_id,
transformer=model_nf4,
text_encoder_3=t5_nf4,
torch_dtype=torch.bfloat16
)
pipeline.enable_model_cpu_offload()
prompt = "A whimsical and creative image depicting a hybrid creature that is a mix of a waffle and a hippopotamus, basking in a river of melted butter amidst a breakfast-themed landscape. It features the distinctive, bulky body shape of a hippo. However, instead of the usual grey skin, the creature's body resembles a golden-brown, crispy waffle fresh off the griddle. The skin is textured with the familiar grid pattern of a waffle, each square filled with a glistening sheen of syrup. The environment combines the natural habitat of a hippo with elements of a breakfast table setting, a river of warm, melted butter, with oversized utensils or plates peeking out from the lush, pancake-like foliage in the background, a towering pepper mill standing in for a tree. As the sun rises in this fantastical world, it casts a warm, buttery glow over the scene. The creature, content in its butter river, lets out a yawn. Nearby, a flock of birds take flight"
image = pipeline(
prompt=prompt,
num_inference_steps=4,
guidance_scale=0.0,
max_sequence_length=512,
).images[0]
image.save("whimsical.png")
📚 详细文档
模型描述
属性 |
详情 |
开发方 |
Stability AI |
模型类型 |
MMDiT文本到图像生成模型 |
模型说明 |
该模型根据文本提示生成图像。它是一个经过ADD蒸馏的 多模态扩散变压器,使用三种固定的预训练文本编码器,并采用QK归一化。 |
许可证
- 社区许可证:对于研究、非商业用途以及年总收入低于100万美元的组织或个人的商业用途免费。更多详细信息可在 社区许可协议 中找到。请访问https://stability.ai/license 了解更多。
- 年总收入超过100万美元的个人和组织:请 联系我们 获取企业许可证。
模型来源
对于本地或自托管使用,我们推荐使用 ComfyUI 进行基于节点的UI推理,或使用 diffusers 或 GitHub 进行编程使用。
文件结构
点击此处访问 文件和版本标签
│
├── text_encoders/ (text_encoder/text_encoder_1/text_encoder_2 are for diffusers)
│ ├── README.md
│ ├── clip_g.safetensors
│ ├── clip_l.safetensors
│ ├── t5xxl_fp16.safetensors
│ └── t5xxl_fp8_e4m3fn.safetensors
│
├── README.md
├── LICENSE
├── sd3_large_turbo.safetensors
├── SD3.5L_Turbo_example_workflow.json
└── sd3_large_turbo_demo.png
** 以下文件结构用于diffusers集成 **
├── scheduler/
├── text_encoder/
├── text_encoder_2/
├── text_encoder_3/
├── tokenizer/
├── tokenizer_2/
├── tokenizer_3/
├── transformer/
├── vae/
└── model_index.json
用途
预期用途
预期用途包括以下方面:
- 艺术品生成以及在设计和其他艺术过程中的应用。
- 在教育或创意工具中的应用。
- 对生成模型的研究,包括了解生成模型的局限性。
模型的所有使用都必须符合我们的 可接受使用政策。
非预期用途
该模型并非用于对人物或事件进行事实性或真实的呈现。因此,使用该模型生成此类内容超出了该模型的能力范围。
安全性
作为我们以安全为设计理念和负责任的AI部署方法的一部分,我们采取了深思熟虑的措施,以确保在开发的早期阶段就保证模型的完整性。我们在模型开发的整个过程中实施了安全措施。我们已经实施了旨在降低某些危害风险的安全缓解措施,然而,我们建议开发人员根据其特定用例进行自己的测试并应用额外的缓解措施。
有关我们的安全方法的更多信息,请访问我们的 安全页面。
完整性评估
我们的完整性评估方法包括结构化评估和针对某些危害的红队测试。测试主要以英语进行,可能无法涵盖所有可能的危害。
已识别的风险和缓解措施
- 有害内容:我们在训练模型时使用了经过过滤的数据集,并实施了保障措施,试图在实用性和防止危害之间取得适当的平衡。然而,这并不能保证所有可能的有害内容都已被移除。所有开发人员和部署人员应谨慎行事,并根据其特定的产品政策和应用用例实施内容安全防护措施。
- 滥用:技术限制以及对开发人员和最终用户的教育有助于减轻模型的恶意应用。所有用户都必须遵守我们的 可接受使用政策,包括在应用微调和平提示工程机制时。请参考Stability AI可接受使用政策,了解我们产品的违规使用信息。
- 隐私侵犯:鼓励开发人员和部署人员采用尊重数据隐私的技术,遵守隐私法规。
联系我们
请报告模型的任何问题或与我们联系:
- 安全问题:safety@stability.ai
- 安全漏洞:security@stability.ai
- 隐私问题:privacy@stability.ai
- 许可证和一般问题:https://stability.ai/license
- 企业许可证:https://stability.ai/enterprise
🔧 技术细节
- QK归一化:实现QK归一化技术以提高训练稳定性。
- 对抗性扩散蒸馏 (ADD):(见 技术报告),允许在4步采样内生成高质量图像。
- 文本编码器:
- 训练数据和策略:该模型在各种数据上进行训练,包括合成数据和经过过滤的公开可用数据。
有关原始MMDiT架构的更多技术细节,请参考 研究论文。
模型性能
请参阅 博客 了解我们关于提示遵循度和美学质量的比较性能研究。
📄 许可证
本模型采用 Stability AI社区许可证。请访问https://stability.ai/license 了解更多信息。