Enhancing Diffusion Models with Text-Encoder Reinforcement Learning
Official PyTorch codes for paper Enhancing Diffusion Models with Text-Encoder Reinforcement Learning
Results on SD-Turbo
We applied our method to the recent model sdturbo. The model is trained with Q-Instruct feedback through direct back-propagation to save training time. Test with the following codes
## Note: sdturbo requires latest diffusers>=0.24.0 with AutoPipelineForText2Image class
from diffusers import AutoPipelineForText2Image
from peft import PeftModel
import torch
pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sd-turbo", torch_dtype=torch.float16, variant="fp16")
pipe = pipe.to("cuda")
PeftModel.from_pretrained(pipe.text_encoder, 'chaofengc/sd-turbo_texforce')
pt = ['a photo of a cat.']
img = pipe(prompt=pt, num_inference_steps=1, guidance_scale=0.0).images[0]