Edit model card

Finetuning ddpm-celebahq-256 model with DDPO for aesthetic quality enhancement

DDPO Paper: Training Diffusion Models with Reinforcement Learning

Authors: Kevin Black, Michael Janner, Yilun Du, Ilya Kostrikov, Sergey Levine

Abstract:

Diffusion models are a class of flexible generative models trained with an approximation to the log-likelihood objective. However, most use cases of diffusion models are not concerned with likelihoods, but instead with downstream objectives such as human-perceived image quality or drug effectiveness. In this paper, we investigate reinforcement learning methods for directly optimizing diffusion models for such objectives. We describe how posing denoising as a multi-step decision-making problem enables a class of policy gradient algorithms, which we refer to as denoising diffusion policy optimization (DDPO), that are more effective than alternative reward-weighted likelihood approaches. Empirically, DDPO is able to adapt text-to-image diffusion models to objectives that are difficult to express via prompting, such as image compressibility, and those derived from human feedback, such as aesthetic quality. Finally, we show that DDPO can improve prompt-image alignment using feedback from a vision-language model without the need for additional data collection or human annotation. The project's website can be found at this http URL.

Inference

DDPM based models can use discrete noise schedulers such as:

for inference. Note that while the ddpm scheduler yields the highest quality, it also takes the longest. For a good trade-off between quality and inference speed you might want to consider the ddim or pndm schedulers instead.

See the following code:

# !pip install diffusers
from diffusers import DDPMPipeline, DDIMPipeline, PNDMPipeline

model_id = "alkzar90/ddpo-aesthetic-celebahq-256"

# load model and scheduler
ddpm = DDPMPipeline.from_pretrained(model_id)  # you can replace DDPMPipeline with DDIMPipeline or PNDMPipeline for faster inference

# run pipeline in inference (sample random noise and denoise)
image = ddpm().images[0]

# save image
image.save("ddpo_aesthetic_generated_image.png")

For more in-detail information, please have a look at the official inference example

Samples

Celeba-HQ 256x256 generated samples from the DDPO finetuned model optimized by
LAION aesthetic score

Downloads last month
9
Inference API
Inference API (serverless) does not yet support diffusers models for this pipeline type.