Diffusers 文档
DreamBooth
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
DreamBooth
DreamBooth 是一种生成特定实例个性化图像的方法。它的工作原理是对主体的 3-5 张图像(例如,一只猫)进行模型微调,这些图像与一个唯一的标识符(`sks cat`)相关联。这允许您在提示中使用 `sks cat` 来触发模型生成您的猫在不同设置、光照、姿势和风格下的图像。
DreamBooth 检查点通常有几 GB 大小,因为它包含完整的模型权重。
使用 from_pretrained() 加载 DreamBooth 检查点,并在提示中包含唯一的标识符以激活其生成。
import torch
from diffusers import AutoPipelineForText2Image
pipeline = AutoPipelineForText2Image.from_pretrained(
"sd-dreambooth-library/herge-style",
torch_dtype=torch.float16
).to("cuda")
prompt = "A cute sks herge_style brown bear eating a slice of pizza, stunning color scheme, masterpiece, illustration"
pipeline(prompt).images[0]
