🚀 SDXL InstructPix2Pix (768768)
本項目基於InstructPix2Pix的方法,對Stable Diffusion XL (SDXL)進行指令微調。以下是一些生成結果示例:
編輯指令:"將天空變為多雲的樣子"

編輯指令:"將其變成畢加索風格的畫作"

編輯指令:"讓人物看起來更老一些"

🚀 快速開始
📦 安裝指南
在使用之前,請確保安裝所需的庫:
pip install accelerate transformers
pip install git+https://github.com/huggingface/diffusers
💻 使用示例
基礎用法
import torch
from diffusers import StableDiffusionXLInstructPix2PixPipeline
from diffusers.utils import load_image
resolution = 768
image = load_image(
"https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
).resize((resolution, resolution))
edit_instruction = "Turn sky into a cloudy one"
pipe = StableDiffusionXLInstructPix2PixPipeline.from_pretrained(
"diffusers/sdxl-instructpix2pix-768", torch_dtype=torch.float16
).to("cuda")
edited_image = pipe(
prompt=edit_instruction,
image=image,
height=resolution,
width=resolution,
guidance_scale=3.0,
image_guidance_scale=1.5,
num_inference_steps=30,
).images[0]
edited_image.save("edited_image.png")
更多詳細信息,請參考文檔。
⚠️ 重要提示
此檢查點本質上是實驗性的,有很大的改進空間。請使用本倉庫的“討論”標籤來提出問題和進行討論。
🔧 技術細節
訓練
我們使用InstructPix2Pix訓練方法對SDXL進行了15000步的微調,在768x768的圖像分辨率上使用了固定學習率5e - 6。
我們的訓練腳本和其他實用工具可以在這裡找到,它們是基於我們的官方訓練腳本構建的。
我們的訓練日誌可以在Weights and Biases上查看這裡。請參考此鏈接瞭解所有超參數的詳細信息。
訓練數據
我們使用了這個數據集:timbrooks/instructpix2pix-clip-filtered。
計算資源
使用一臺配備8張A100顯卡的機器。
批量大小
採用數據並行,單GPU批量大小為8,總批量大小為32。
混合精度
使用FP16。
📄 許可證
本項目採用OpenRAIL++許可證。
信息表格
屬性 |
詳情 |
基礎模型 |
stabilityai/stable-diffusion-xl-base-1.0 |
標籤 |
stable-diffusion-xl、stable-diffusion-xl-diffusers、text-to-image、diffusers、instruct-pix2pix |
推理 |
否 |
數據集 |
timbrooks/instructpix2pix-clip-filtered |
許可證 |
OpenRAIL++ |