dpo-sdxl-text2image-v1

我要开发同款
匿名用户2024年07月31日
30阅读
所属分类aiPytorch
开源地址https://modelscope.cn/models/AI-ModelScope/dpo-sdxl-text2image-v1
授权协议Apache License 2.0

作品详情

Diffusion Model Alignment Using Direct Preference Optimization

row01

Direct Preference Optimization (DPO) for text-to-image diffusion models is a method to align diffusion models to text human preferences by directly optimizing on human comparison data. Please check our paper at Diffusion Model Alignment Using Direct Preference Optimization.

This model is fine-tuned from stable-diffusion-xl-base-1.0 on offline human preference data pickapic_v2.

Code

Code will come soon!!!

SD1.5

We also have a model finedtuned from stable-diffusion-v1-5 available at dpo-sd1.5-text2image-v1.

A quick example

from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel
from modelscope import snapshot_download
import torch

# load pipeline
model_id_base = "AI-ModelScope/stable-diffusion-xl-base-1.0"
local_base = snapshot_download(model_id_base,revision='master')
pipe = StableDiffusionXLPipeline.from_pretrained(local_base, torch_dtype=torch.float16, variant="fp16", use_safetensors=True).to("cuda")

# load finetuned model
unet_id = "AI-ModelScope/dpo-sdxl-text2image-v1"
local_unet = snapshot_download(unet_id,revision='master')
unet = UNet2DConditionModel.from_pretrained(local_unet, subfolder="unet", torch_dtype=torch.float16)
pipe.unet = unet
pipe = pipe.to("cuda")

prompt = "Two cats playing chess on a tree branch"
image = pipe(prompt, guidance_scale=5).images[0].resize((512,512))

image.save("cats_playing_chess.png")

More details coming soon.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论