Use playground for inpainting
#31
by
baldesco
- opened
Hello
I am trying to use this model for inpainting, but the quality of the generated images is not good. I am using the code below.
Am I doing something wrong?
import torch
from diffusers import AutoPipelineForInpainting, AutoencoderKL
from diffusers.utils import load_image, make_image_grid
MODEL_ID = "playgroundai/playground-v2.5-1024px-aesthetic"
VAE_ID = "madebyollin/sdxl-vae-fp16-fix"
MODEL_CACHE = "data/diffusers-cache"
vae = AutoencoderKL.from_pretrained(
VAE_ID,
torch_dtype=torch.float16,
cache_dir=MODEL_CACHE,
)
model = AutoPipelineForInpainting.from_pretrained(
MODEL_ID,
vae=vae,
cache_dir=MODEL_CACHE,
# variant="fp16",
torch_dtype=torch.float16,
use_safetensors=True,
)
model.to("cuda")
model.scheduler = EDMDPMSolverMultistepScheduler()
generator = torch.Generator("cuda").manual_seed(seed)
imgs = []
prompt = "tomato soup"
for i in range(4):
output = model(
prompt=prompt,
negative_prompt="",
image=temp_image,
mask_image=mask_image,
num_images_per_prompt=1,
guidance_scale=3.0,
generator=generator,
num_inference_steps=30,
# strength=1.0,
).images[0]
imgs.append(output)
make_image_grid(imgs, 2, 2, 400)