Replacer is an extention for https://github.com/AUTOMATIC1111/stable-diffusion-webui. The goal of this extention is to automate objects masking by detection prompt, using sd-webui-segment-anything, and img2img inpainting in one easy to use tab. Aka "Fast Inpaint"
- Install sd-webui-segment-anything extention
- Put model sam_hq_vit_l.pth (or others) into
extensions/sd-webui-segment-anything/models/sam
- (Optional) For faster hires fix, download lcm-lora-sdv1-5, rename it into
lcm-lora-sdv1-5.safetensors
, put intomodels/Lora
- Install this extention
- Reload UI
You just need to upload your image, enter 3 prompts, and click "Run". You can override prompts examples in Settings with your commonly using prompts. Don't forget to select inpaint checkpoint
Be sure you are using inpainting model
By default if a prompt is empty, it uses first prompt from examples. You can disable this behavior in settings for positive and negative prompts. Detection prompt can not be empty
Default settings designed for using lcm lora for fast upscale. It requires lcm lora I mentioned, cfg scale 1.0 and sampling steps 4. There is no difference in quality for my opinion
Despite in txt2img for lcm lora DPM++ samplers produses awful results, while hires fix it produces a way better result. So I recommend to "Use the same sampler" option
I do not recommend change these options, if you don't know what you do
If you don't like "Replacer" name of this extention, you can override it using envirovment variable SD_WEBUI_REPLACER_EXTENTION_NAME
For exaple: Linux
export SD_WEBUI_REPLACER_EXTENTION_NAME="Fast Inpaint"
Or Windows in your .bat
file:
set SD_WEBUI_REPLACER_EXTENTION_NAME="Fast Inpaint"
You need to reload the web page, then set your desirable settings. Then go to the "Defaults" section in "Settings" tab. Click "View changes", check is it ok, then click "Apply" and "Reload UI"
I recommend to use EpicPhotoGasm - Z - Inpainting model for realism. If you've already have your favourite model, but it doesn't have inpainting model, you can make it in "Checkpoint Merger" tab:
- Select your target model as "model B"
- Select sd-v1-5-inpainting as "model A"
- Select
sd_v1-5-pruned-emaonly
as "model C" - Set
Custom Name
the same as your target model name (.inpainting
suffix will be added automatically) - Set
Multiplier (M)
to 1.0 - Select
Interpolation Method
to "add difference", and "Save as float16" - Merge
- ☑️ cache mask
- ☑️ batch processing
- ☑️ "apply hires fix" button
- ☑️ additional options
- progress bar + interrupt
- option for pass into hires fix automatically
- batch get options from png info
- control net
- tiled vae
- "hide segment anything extention" option
- txt2img script
- add detection parametres in metadata
- add additional options: include mask or preview, and do exacly steps the slider specifies
- extra mask expand for hires fix
- copy
images
while appling hires fix - handle empty out dir in batch dir
- turn sam_predict, update_mask into global functions