🚀 stable-diffusion-xl-1.0-turbo-GGUF
stable-diffusion-xl-1.0-turbo-GGUF 是一個文本到圖像的生成模型,基於 SDXL-Turbo 進行 GGUF 量化。它能快速根據文本提示合成逼真圖像,支持特定版本的 llama-box。
🚀 快速開始
此模型僅由 gpustack/llama-box v0.0.75+ 實驗性支持!
若要開始使用該模型,可查看 https://github.com/Stability-AI/generative-models 。
✨ 主要特性
- 快速生成:SDXL-Turbo 是快速的文本到圖像生成模型,能在單次網絡評估中根據文本提示合成逼真圖像。
- 多種量化支持:提供 FP16、Q8_0、Q4_1、Q4_0 等多種量化方式。
- 即時演示:可通過 即時演示 體驗。
📦 安裝指南
安裝依賴
pip install diffusers transformers accelerate --upgrade
💻 使用示例
基礎用法
文本到圖像
SDXL-Turbo 不使用 guidance_scale
或 negative_prompt
,通過 guidance_scale=0.0
禁用。模型優選生成 512x512 大小的圖像,但更高尺寸也適用,單步即可生成高質量圖像。
from diffusers import AutoPipelineForText2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
prompt = "A cinematic shot of a baby racoon wearing an intricate italian priest robe."
image = pipe(prompt=prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
圖像到圖像
使用 SDXL-Turbo 進行圖像到圖像生成時,確保 num_inference_steps
* strength
大於或等於 1。圖像到圖像管道將運行 int(num_inference_steps * strength)
步。
from diffusers import AutoPipelineForImage2Image
from diffusers.utils import load_image
import torch
pipe = AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png").resize((512, 512))
prompt = "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k"
image = pipe(prompt, image=init_image, num_inference_steps=2, strength=0.5, guidance_scale=0.0).images[0]
📚 詳細文檔
模型詳情
模型描述
SDXL-Turbo 是 SDXL 1.0 的蒸餾版本,專為即時合成訓練。它基於名為對抗擴散蒸餾(ADD)的新型訓練方法(參見 技術報告),允許在 1 到 4 步內以高圖像質量對大規模基礎圖像擴散模型進行採樣。
模型來源
用於研究目的,推薦使用 generative-models GitHub 倉庫,該倉庫實現了最流行的擴散框架(包括訓練和推理)。
- 倉庫:https://github.com/Stability-AI/generative-models
- 論文:https://stability.ai/research/adversarial-diffusion-distillation
- 演示:http://clipdrop.co/stable-diffusion-turbo
評估
上述圖表評估了用戶對 SDXL-Turbo 相對於其他單步和多步模型的偏好。在圖像質量和遵循提示方面,單步評估的 SDXL-Turbo 比四步(或更少)評估的 LCM-XL 更受人類投票者青睞。此外,SDXL-Turbo 使用四步進一步提高了性能。用戶研究詳情可參考 研究論文。
用途
直接使用
該模型適用於非商業和商業用途。可在 此許可證 下用於非商業或研究目的,可能的研究領域和任務包括:
- 生成模型研究。
- 生成模型即時應用研究。
- 即時生成模型影響研究。
- 可能生成有害內容的模型的安全部署。
- 探究和理解生成模型的侷限性和偏差。
- 藝術品生成及在設計和其他藝術過程中的應用。
- 教育或創意工具中的應用。
商業使用請參考 https://stability.ai/membership 。
超出範圍的使用
該模型未針對生成事實或真實的人物或事件表示進行訓練,因此使用該模型生成此類內容超出了其能力範圍。模型不應以任何違反 Stability AI 可接受使用政策 的方式使用。
侷限性和偏差
侷限性
- 生成的圖像分辨率固定為 512x512 像素,模型無法實現完美的照片級真實感。
- 模型無法渲染清晰的文本。
- 面部和人物一般可能無法正確生成。
- 模型的自動編碼部分存在損失。
建議
該模型適用於非商業和商業用途。
🔧 技術細節
GGUF 量化基於 stable-diffusion.cpp ac54e,由 llama-box 打補丁。VAE 來自 madebyollin/sdxl-vae-fp16-fix。
量化方式 |
OpenAI CLIP ViT-L/14 量化 |
OpenCLIP ViT-G/14 量化 |
VAE 量化 |
FP16 |
FP16 |
FP16 |
FP16 |
Q8_0 |
FP16 |
FP16 |
FP16 |
Q4_1 |
FP16 |
FP16 |
FP16 |
Q4_0 |
FP16 |
FP16 |
FP16 |
📄 許可證
- 許可證類型:other
- 許可證名稱:sai-nc-community
- 許可證鏈接:https://huggingface.co/stabilityai/sdxl-turbo/blob/main/LICENSE.md
⚠️ 重要提示
對於商業使用,請參考 https://stability.ai/license 。模型使用不應違反 Stability AI 的 可接受使用政策。
💡 使用建議
該模型優選生成 512x512 大小的圖像,但更高尺寸也適用。進行圖像到圖像生成時,確保 num_inference_steps
* strength
大於或等於 1。