huchenlei / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
2 stars 0 forks source link

Inpaint fix #6

Closed huchenlei closed 4 months ago

huchenlei commented 4 months ago

Description

According to https://github.com/lllyasviel/stable-diffusion-webui-forge/discussions/716#discussioncomment-9348247 , the check of whether the model is sdxl inpaint is calling state_dict on every sampling step. state_dict is a very expensive function that costs ~40ms. This overhead is for all inference regardless of model type, which is dumb.

This PR precomputes is_sdxl_inpaint flag so that we do not call state_dict on every sampling step.

Original PR that introduce this change: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14390

Screenshots/videos:

image

Checklist: