DeepCache icon indicating copy to clipboard operation
DeepCache copied to clipboard

Does it support SD-Inpaint model?

Open kadirnar opened this issue 2 years ago • 4 comments

I changed the UNet2DConditionModel, ImageProjection and DiffusionPipeline functions in the pipeline_stable_diffusion_inpaint.py file. The code is fast but the output is terrible. What can I do to improve this?

kadirnar avatar Dec 09 '23 18:12 kadirnar

Code:

outputv0 = pipe(
    prompt, 
    image=image,
    mask_image=mask,
    num_inference_steps=35,
    guidance_scale=5.0,
    strength=1.0,
    num_images_per_prompt=1,
    cache_interval=5, 
    cache_layer_id=0, 
    cache_block_id=0,
    uniform=True,
    output_type='pil', 
    return_dict=True
).images

image

kadirnar avatar Dec 09 '23 18:12 kadirnar

Hi @kadirnar, please tune the cache_interval, cache_layer_id & cache_block_id. Caching in a deeper layer can improve the quality yet reduce the speedup.

VainF avatar Dec 12 '23 09:12 VainF

Hi @kadirnar, please tune the cache_interval, cache_layer_id & cache_block_id. Caching in a deeper layer can improve the quality yet reduce the speedup.

Can you suggest sample values? I don't know what values I should give.

kadirnar avatar Dec 12 '23 10:12 kadirnar

Maybe we can use a smaller cache_interval like 3 or 4, and choose a deeper layer for caching by increasing the cache_block_id & cache_layer_id. cache_layer_id=0 & cache_block_id=0 uses the very first skip connection for caching.

VainF avatar Dec 12 '23 10:12 VainF