Giter Club home page Giter Club logo

sd-webui-replacer's Introduction

Replacer

Replacer is an extension for AUTOMATIC1111/stable-diffusion-webui. The goal of this extension is to automate objects masking by detection prompt, using sd-webui-segment-anything, and img2img inpainting in one easy to use tab. It also useful for batch inpaint, and inpaint in video with AnimateDiff

You also can draw your mask instead of or in addition to detection, and take advantage of convenient HiresFix option, and ControlNet inpainting with preserving original image resolution and aspect ratio

If you find this project useful, please star it on GitHub!

Installation

  1. Install sd-webui-segment-anything extension. If it bothers you, you can hide it in the Replacer's settings. Go to tab Extension -> Avaliable -> click Load from and search "sd-webui-segment-anything"
  2. Download model sam_hq_vit_l.pth, or others from the list bellow, and put it into extensions/sd-webui-segment-anything/models/sam
  3. For faster hires fix, download lcm-lora-sdv1-5, rename it into lcm-lora-sdv1-5.safetensors, put into models/Lora. Or if you have already lcm lora, then change hires suffix in the extension options
  4. Install this extension. Go to tab Extension -> Available -> click Load from and search "Replacer". Be sure your sd-webui version is >= 1.5.0. For AMD and Intel GPUs, and maby something else, you need to enable CPU for detection in Replacer's settings. Go to Settings -> Replacer and enable it
  5. Reload UI

If you don't want to use Video feature, that's all for you. Further steps are for Video:

  1. Install sd-webui-animatediff and sd-webui-controlnet extensions. You should also use Extension -> Available tab and find them there
  2. Download mm_sd15_v3.safetensors animatediff's moution model, and put it into extensions/sd-webui-animatediff/model directory
  3. Download control_v11p_sd15_inpaint_fp16.safetensors controlnet's model and put it into models/ControlNet directory
  4. I strongly recommend you to download mm_sd15_v3_sparsectrl_rgb.safetensors and mm_sd15_v3_sparsectrl_scribble.safetensors controlnet's models. Put them also into models/ControlNet directory. Then you can select SparseCtrl module in ControlNet extension. The rgb one requires "none" preprocessor

SAM models list:

SAM-HQ are the best for me. Choose it depending on your vram. Sum this model size with dino model size (694MB-938MB)

  1. SAM from Meta AI.

  2. SAM-HQ from SysCV.

  3. MobileSAM from Kyung Hee University.

FastSAM and Matting-Anything aren't currently supported

Supported extensons:

  1. Lama cleaner as masked content

  2. Inpaint Difference (discontinued)

  3. Image Comparison

  4. ControlNet

  5. AnimateDiff

How does it work?

First, grounding dino models detect objects you provided in the detection prompt. Then segment anything model generates contours of them. And then extension chooses randomly 1 of 3 generated masks, and inpaints it with regular inpainting method in a1111 webui

When you press the "Apply hires fix" button, the extension regenerates the image with exactly the same settings, excluding upscaler_for_img2img. Then it applies inpainting with "Original" masked content mode and lower denoising but higher resolution.

Docs:


Need to do:

  • ☑️ cache mask
  • ☑️ batch processing
  • ☑️ "apply hires fix" button
  • ☑️ additional options
  • ☑️ progress bar + interrupt
  • ☑️ option for pass into hires fix automatically
  • ☑️ control net
  • ☑️ pass previous frame into ControlNet for video
  • tiled vae
  • ☑️ "hide segment anything extention" option
  • ☑️ txt2img script
  • more video and mask input types
  • RIFE frames inperpolation
  • allow multiply instances (presets)

small todo:

  • add hires fix args into metadata
  • FreeInit support

sd-webui-replacer's People

Contributors

fsdadsafadfs avatar light-and-ray avatar ruslanuc avatar silveroxides avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sd-webui-replacer's Issues

Avoidance not show up

How to show Avoidance Prompt in replacer ? because ive seen it in the setting, but not show in Replacer Tab, Thanks

image

may i ask

what is that button there?
is that included in this extention?

image

Support for Forge Foocus inpainting?

Foocus inpainting allows you to inpaint with any model and it works really well, even with SDXL models. would it be possible to allow your addon feature that?

Since Forge has some of Foocus capabilities and i believe the inpainting was just added recently would it be now possible to utilise it?

(Amd and Intel) torch_directml

My error:
[F D:\a_work\1\s\pytorch-directml-plugin\torch_directml\csrc\engine\dml_tensor_desc.cc:135] Check failed: !is_dim_broadcast || non_broadcast_dim_size == 1
Is there a way to make it work on Amd card?

Replacer break "multi-input" controlNet feature.

if we have replacer in extensions list and it's active we can't use "multi-input" in controlnet itself (not as part of replacer but just controlnet itself). It's force to the next error. If in the extensions list we untick replacer and reload gui then everything become ok.

ValueError: controlnet is enabled but no input image is given
argument list:
set COMMANDLINE_ARGS=--xformers --update-all-extensions
Everything updated to last versions through --update-all-extensions at every launch.
image
p.s. I'm ssory for bad english.

controlnet option disappeared

so it was there and now.. its no longer there, I'm using Forge, I'm not sure if its because i installed the animatediff stuff

Forge support

Using SD Forge, been able to use Replacer just fine, updated today and I don't have the page tab, this is the error message that appears after the webui opens

***[Replacer] error while creating dedicated page: 'NoneType' object has no attribute 'getReplacerTabUI'
Traceback (most recent call last):
File "F:\stable-diffusion-webui-forge\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 37, in mountDedicatedPage
tab = replacer_tab_ui.replacerMainUI_dedicated.getReplacerTabUI()
AttributeError: 'NoneType' object has no attribute 'getReplacerTabUI'
  • sd-webui-animatediff | master | 85a854b4 | 2024-04-14 23:58:58 (added patch 499)
  • sd-webui-replacer | master | b7b62df | 2024-04-14 22:10:52
  • sd-webui-segment-anything | master | 982138cf | 2024-02-23 20:25:02

Support for the Inpaint difference extension is very unstable

Hello, I just saw that you added support for the Inpaint difference extension!

One problem I see is that you are using the compute_mask function directly. I just updated it like a week ago to add a few parameters to it, so in a sense, it is not a stable way to do this.

If I modify the arguments passed to the function (I still have a few things I want to do, so very possible), this is gonna break on your side, and you don't want to spend your time fixing these sort of issues.

The better way to implement this would be to implement it in a more implicit way. Probably not possible, but calling compute_mask with a variable amount of parameters (*args) would be better, for example. You could also highjack it, and run your extension when the compute_mask function returns? I really don't know to be honest, but something like that.

The same problem happens for using the gradio elements of the Inpaint difference extension directly in yours. Basically, you want to stay as agnostic as possible to how other extensions work.

Inpaint difference relies on a library I'm maintaining, sdwi2iextender. The point is to unify how img2img tabs are added. Maybe your extension would benefit from using it? Instead of being a full fledged tab, it could maybe fit into an img2img tab? I don't know, it sounds like it could when I look at the readme.

AttributeError: type object 'ControlNetUiGroup' has no attribute 'all_ui_groups'

*** Error executing callback ui_tabs_callback for C:\stable-diffusion-webui-master\extensions\sd-webui-replacer\scripts\replacer_main_ui.py
Traceback (most recent call last):
File "C:\stable-diffusion-webui-master\modules\script_callbacks.py", line 166, in ui_tabs_callback
res += c.callback() or []
File "C:\stable-diffusion-webui-master\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 15, in on_ui_tabs
replacerTabUi = getReplacerTabUI(isDedicatedPage=False)
File "C:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\tab_ui.py", line 70, in getReplacerTabUI
cnUiGroupsLenBefore = len(replacer_scripts.ControlNetUiGroup.all_ui_groups)
AttributeError: type object 'ControlNetUiGroup' has no attribute 'all_ui_groups'


*** [Replacer] error while creating dedicated page: type object 'ControlNetUiGroup' has no attribute 'all_ui_groups'
Traceback (most recent call last):
File "C:\stable-diffusion-webui-master\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 35, in mountDedicatedPage
getReplacerTabUI(isDedicatedPage=True)
File "C:\stable-diffusion-webui-master\extensions\sd-webui-replacer\replacer\tab_ui.py", line 70, in getReplacerTabUI
cnUiGroupsLenBefore = len(replacer_scripts.ControlNetUiGroup.all_ui_groups)
AttributeError: type object 'ControlNetUiGroup' has no attribute 'all_ui_groups'


### I updated to 1.7.0 and made a fresh installation.

venv "C:\stable-diffusion-webui-master\venv\Scripts\Python.exe"
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: 1.7.0
Commit hash:

applyHiresFix is not supported for batch

Is your feature request related to a problem? Please describe.
Yes, the problem is that the "applyHiresFix" function is not supported for batch processing, causing frustration for users who rely on this feature to enhance the quality of their hires images.

Describe the solution you'd like
I would like the "applyHiresFix" function to be extended to support batch processing. This would enable users to efficiently apply the fix to multiple images at once, saving time and effort.

Describe alternatives you've considered
One alternative solution could be to manually apply the "applyHiresFix" function to each image individually, but this would be time-consuming and inefficient, especially when dealing with a large number of images.

Additional context
It would be helpful to have this feature implemented as soon as possible, as it would greatly improve the usability and efficiency of the application for users who frequently work with batches of images.

Avoidance prompt disapper

Hello,
after some update (I'm not able to say date) I don't see table for entering Avoidance promts. I see Detection promt table and next then is Positive prompt table without Avoidance promt table how it was in past.

Thanks
I moved it into advanced options

ControlNet disappeared

The controlNet option is no longer availabe since the last update a couple of hours ago, Would you please look into this? Besides that, thank you very much for your great work!

pls advise how to fix this error AttributeError: 'KDiffusionSampler' object has no attribute 'vec_cc'

[Replacer] Exception: 'KDiffusionSampler' object has no attribute 'vec_cc'
*** Error completing request
*** Arguments: ('task(wtzt3emgu5f2k1g)', 'pants', 'shoes,jacket', 'green pants', '', 0.0, <PIL.Image.Image image mode=RGBA size=720x1280 at 0x24632236B90>, None, 'E:\Pro_Video\dn01_0111\rev\i', '', True, '', 10, '', -1, 'DPM++ 2M SDE Karras', 20, 0.3, 4, 4, 1280, 'sam_vit_h_4b8939.pth', 'GroundingDINO_SwinB (938MB)', 8, 1, 40, 0, 720, 1, 1280, 1, 0, False, []) {}
Traceback (most recent call last):
File "D:\Sdwebui-graph\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "D:\Sdwebui-graph\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "D:\Sdwebui-graph\extensions\sd-webui-replacer\replacer\generate.py", line 488, in generate_webui
return generate(*args, **kwargs)
File "D:\Sdwebui-graph\extensions\sd-webui-replacer\replacer\generate.py", line 349, in generate
processed, extraImages = generateSingle(image, gArgs, saveDir, "", save_to_dirs, extra_includes,
File "D:\Sdwebui-graph\extensions\sd-webui-replacer\replacer\generate.py", line 146, in generateSingle
processed = inpaint(image, gArgs, savePath, saveSuffix, save_to_dirs,
File "D:\Sdwebui-graph\extensions\sd-webui-replacer\replacer\generate.py", line 94, in inpaint
processed = process_images(p)
File "D:\Sdwebui-graph\modules\processing.py", line 734, in process_images
res = process_images_inner(p)
File "D:\Sdwebui-graph\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "D:\Sdwebui-graph\modules\processing.py", line 868, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "D:\Sdwebui-graph\extensions\sd-webui-bmab\sd_bmab\sd_override\img2img.py", line 14, in sample
return super().sample(conditioning, unconditional_conditioning, seeds, subseeds, subseed_strength, prompts)
File "D:\Sdwebui-graph\modules\processing.py", line 1527, in sample
samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
File "D:\Sdwebui-graph\modules\sd_samplers_kdiffusion.py", line 188, in sample_img2img
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "D:\Sdwebui-graph\modules\sd_samplers_common.py", line 261, in launch_sampling
return func()
File "D:\Sdwebui-graph\modules\sd_samplers_kdiffusion.py", line 188, in
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "D:\Sdwebui-graph\python\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "D:\Sdwebui-graph\repositories\k-diffusion\k_diffusion\sampling.py", line 628, in sample_dpmpp_2m_sde
callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
File "D:\Sdwebui-graph\extensions\sd-webui-vectorscope-cc\scripts\cc_callback.py", line 9, in cc_callback
if not self.vec_cc['enable']:
AttributeError: 'KDiffusionSampler' object has no attribute 'vec_cc'

ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)

*** Error loading script: replacer_main_ui.py
Traceback (most recent call last):
File "G:\Programas\ai stable difusion\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "G:\Programas\ai stable difusion\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "G:\Programas\ai stable difusion\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 4, in
from modules import scripts, shared, sd_samplers, ui_toprow, ui
ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)


I'm getting this error with replacer, do you know how to fix?

ControlNet Run preprocessor not working

Hello,
after some update (I'm not able to say date) I encounters problem regarding ControlNet tab in Replacer. When I upload image to ControlNet and want to see "Preprocessor preview" I'm ussing "Run preprocessor" icon (on the right from preprocessor choice menu). But now when I click on icon nothink happens. There no show any preview. Of course I have turned on "Allow Preview" choice.

EDIT: In txt2img and img2img the icon works.

Thanks

Replacer Tab do not show up, with error message

Python 3.10.6
Win10 64

installed over extension tab

Error message as follow

*** Error executing callback ui_tabs_callback for P:\AI\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py
Traceback (most recent call last):
File "X:\AI\stable-diffusion-webui\modules\script_callbacks.py", line 166, in ui_tabs_callback
res += c.callback() or []
File "X:\AI\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 152, in on_ui_tabs
from scripts.sam import sam_model_list, refresh_sam_models
ModuleNotFoundError: No module named 'scripts.sam'

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 2 for tensor number 1 in the list.

After running with default settings and prompts
Error appears ONLY if any inpainting model is selected (Juggernaut Inpainting for example)

MasksCreator restored from cache
 35%|███████████████████████████████████████████▊                                                                                 | 7/20 [00:01<00:02,  5.94it/s]
    [Replacer]    Exception: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 2 for tensor number 1 in the list.
*** Error completing request
*** Arguments: ('background', 'waterfall', 'poor quality, low quality,  low res', 0, <PIL.Image.Image image mode=RGBA size=450x788 at 0x29AA5C7D090>, None, '', '', True, '', -1, 'DPM++ 2M SDE Karras', 20, 0.3, 35, 4, 'sam_hq_vit_l.pth', 'GroundingDINO_SwinT_OGC (694MB)', 5.5, 1, 20, 0, 512, 1, 512, 1) {}
    Traceback (most recent call last):
      File "C:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "C:\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "C:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_generate.py", line 263, in generate
        generateSingle(image, gArgs, saveDir, "", save_to_dirs)
      File "C:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_generate.py", line 126, in generateSingle
        inpaint(image, gArgs, savePath, saveSuffix, save_to_dirs)
      File "C:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_generate.py", line 80, in inpaint
        processed = process_images(p)
      File "C:\stable-diffusion-webui\modules\processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "C:\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "C:\stable-diffusion-webui\modules\processing.py", line 867, in process_images_inner
        samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
      File "C:\stable-diffusion-webui\modules\processing.py", line 1528, in sample
        samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
      File "C:\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 188, in sample_img2img
        samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "C:\stable-diffusion-webui\modules\sd_samplers_common.py", line 261, in launch_sampling
        return func()
      File "C:\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 188, in <lambda>
        samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
      File "C:\stable-diffusion-webui\venv\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "C:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 626, in sample_dpmpp_2m_sde
        denoised = model(x, sigmas[i] * s_in, **extra_args)
      File "C:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "C:\stable-diffusion-webui\modules\sd_samplers_cfg_denoiser.py", line 169, in forward
        x_out = self.inner_model(x_in, sigma_in, cond=make_condition_dict(cond_in, image_cond_in))
      File "C:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "C:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\external.py", line 112, in forward
        eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs)
      File "C:\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps
        return self.inner_model.apply_model(*args, **kwargs)
      File "C:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 17, in <lambda>
        setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
      File "C:\stable-diffusion-webui\modules\sd_hijack_utils.py", line 28, in __call__
        return self.__orig_func(*args, **kwargs)
      File "C:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model
        x_recon = self.model(x_noisy, t, **cond)
      File "C:\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "C:\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1337, in forward
        xc = torch.cat([x] + c_concat, dim=1)
    RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1 but got size 2 for tensor number 1 in the list.

---

Got this error message when hit run

*** Error completing request
*** Arguments: ('task(rp8ao47xoc9wbsr)', 'short-sleeve white top', 'skirt,head', 'short-sleeve green top', 'poor quality, low quality, low res', 2.0, None, None, 'E:\Pro_Video\dw02_0118\crp\i', '', True, '', 10, '4x-UltraSharp', -1, 'DPM++ 2M SDE Karras', 30, 0.3, 5, 4, 1280, 'sam_vit_h_4b8939.pth', 'GroundingDINO_SwinB (938MB)', 5.5, 1, 40, 0, 1080, 1, 1920, 1, 0, False, []) {}
Traceback (most recent call last):
File "D:\sd-webui-aki-v4.5\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "D:\sd-webui-aki-v4.5\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "D:\sd-webui-aki-v4.5\extensions\sd-webui-replacer\replacer\generate.py", line 474, in generate_webui
return generate(*args, **kwargs)
File "D:\sd-webui-aki-v4.5\extensions\sd-webui-replacer\replacer\generate.py", line 378, in generate
processed.images += allExtraImages
UnboundLocalError: local variable 'processed' referenced before assignment

Error from installing

Hello, after installing this I got this stacktrace on restarting the UI.

*** Error loading script: replacer_main_ui.py
Traceback (most recent call last):
File "C:\Shared\repos\stable_diffusion\webui\modules\scripts.py", line 382, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\Shared\repos\stable_diffusion\webui\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Shared\repos\stable_diffusion\webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 4, in
from modules import scripts, shared, sd_samplers, ui_toprow, ui
ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)

AttributeError: 'NoneType' object has no attribute 'getReplacerTabUI'

Hi,

Getting this error. Automatic1111 is up to date v 1.9

*** Error executing callback ui_tabs_callback for C:\Users\xxxx\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py
Traceback (most recent call last):
File "C:\Users\xxxx\stable-diffusion-webui\modules\script_callbacks.py", line 283, in ui_tabs_callback
res += c.callback() or []
File "C:\Users\xxxx\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 17, in on_ui_tabs
tab = replacer_tab_ui.replacerMainUI.getReplacerTabUI()
AttributeError: 'NoneType' object has no attribute 'getReplacerTabUI'

Error loading script: replacer_main_ui.py

I'm having this error can anyone help me:
*** Error loading script: replacer_main_ui.py
Traceback (most recent call last):
File "C:\a1111\stable-diffusion-webui-directml\modules\scripts.py", line 382, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "C:\a1111\stable-diffusion-webui-directml\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\a1111\stable-diffusion-webui-directml\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 2, in
from modules import scripts, shared, sd_samplers, ui_toprow, ui, script_callbacks
ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)

RuntimeError: CUDA error: an illegal memory access was encountered

I am trying to launch several webui instances with replacer in it to somehow bypass issues with multiple GPU support. I am planning to create reverse proxy that will automatically forward request to free instance. I have 8 GPUs - RTX4090, I am renting them from vast.ai.

Everything works fine on one instance, but when I try to run several instance, on every instance except first one, I have this issue:

torch._C._cuda_emptyCache()
RuntimeError: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

I have 24GB of VRAM for each GPU and it can't even pass 10GB mark, so how it's possible to be OOM?..

Uploading nvidia-smi output and log
image
out.log

Webui first load problem with scripts

I have the latest version of both the plugin and Webui installed, the error also occurred on Forge. When I open Webui for the first time, the controls are not usable on it. I see this error in the Chrome console:

error running callback ƒ replacerRemoveInpaintDiffMaskUpload() {
    const mask = gradioApp().getElementById('replacer_inpaint_diff_mask_view');
    var imageContainer = mask.getElementsByClassName('image-container')[0];
… : TypeError: Cannot read properties of null (reading 'getElementsByClassName')
    at replacerRemoveInpaintDiffMaskUpload (replacer.js?1707903619.0917509:79:31)
    at executeCallbacks (file=script.js?1702938585.5389194:83:13)
    at MutationObserver.<anonymous> (file=script.js?1702938585.5389194:112:9)

file=script.js?1702938585.5389194:85 error running callback ƒ replacerRemoveInpaintDiffMaskUpload() {
    const mask = gradioApp().getElementById('replacer_inpaint_diff_mask_view');
    var imageContainer = mask.getElementsByClassName('image-container')[0];
… : TypeError: Cannot read properties of null (reading 'getElementsByClassName')
    at replacerRemoveInpaintDiffMaskUpload (replacer.js?1707903619.0917509:79:31)
    at executeCallbacks (file=script.js?1702938585.5389194:83:13)
    at MutationObserver.<anonymous> (file=script.js?1702938585.5389194:112:9)

error running callback ƒ replacerApplyZoomAndPanIntegration () {
    if (typeof window.applyZoomAndPanIntegration === "function") {
        window.applyZoomAndPanIntegration_replacer_mod("#replacer_advanced_options", ["#re… : TypeError: window.applyZoomAndPanIntegration_replacer_mod is not a function
    at replacerApplyZoomAndPanIntegration (replacer.js?1707903619.0917509:66:16)
    at executeCallbacks (file=script.js?1702938585.5389194:83:13)
    at MutationObserver.<anonymous> (file=script.js?1702938585.5389194:112:9)

If I disable the extension, the webui runs fine. But then I get this message in the cmd console:
*** Extension "sd-webui-replacer" requires "sd-webui-segment-anything" which is disabled.
The segment-anything is not disabled, so the reverse would be correct:
*** Extension "sd-webui-replacer" is disabled.

bug

Start SAM Processing
Found GroundingDINO in pip. Verifying if dynamic library build success.
GroundingDINO dynamic library have been successfully built.
Running GroundingDINO Inference
Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB)
Initializing SAM to cuda
[Replacer] Exception: ''
*** Error completing request
*** Arguments: ('background', 'waterfall', 'poor quality, low quality, low res', 0, <PIL.Image.Image image mode=RGBA size=512x768 at 0x2353B2A3EE0>, None, '', '', True, '1x-FrankenMapGenerator-CX-Lite', -1, 'DPM++ 2M SDE Karras', 20, 0.3, 35, 4, 'FastSAM-x.pt', 'GroundingDINO_SwinT_OGC (694MB)', 5.5, 1, 20, 0, 512, 1, 768, 1) {}
Traceback (most recent call last):
File "F:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "F:\stable-diffusion-webui\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "F:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_generate.py", line 263, in generate
generateSingle(image, gArgs, saveDir, "", save_to_dirs)
File "F:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_generate.py", line 116, in generateSingle
masksCreator = MasksCreator(gArgs.detectionPrompt, image, gArgs.samModel,
File "F:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_mask_creator.py", line 45, in init
self._createMasks()
File "F:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_mask_creator.py", line 53, in _createMasks
masks, samLog = sam_predict(self.samModel, self.image, [], [], True,
File "F:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 204, in sam_predict sam = init_sam_model(sam_model_name)
File "F:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 129, in init_sam_model
sam_model_cache[sam_model_name] = load_sam_model(sam_model_name)
File "F:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 80, in load_sam_model
sam = sam_model_registrymodel_type
KeyError: ''

POST request error: {'error': 'HTTPException', 'detail': 'Invalid encoded image', 'body': '', 'errors': ''}

Im trying to make a POST request but it throws an error: {'error': 'HTTPException', 'detail': 'Invalid encoded image', 'body': '', 'errors': ''}

Thats how I'm trying to make a request:

photo = Image.open("photos/photo.png")
photo_b64 = base64.b64encode(photo.tobytes()).decode('utf-8')

payload = {
    "input_image": photo_b64,
    "detection_prompt": "car",
    "avoidance_prompt": "people",
    "positive_prompt": "",
    "negative_prompt": "",
    "width": 512,
    "height": 512,
    "sam_model_name": "sam_vit_h_4b8939.pth",
    "dino_model_name": "GroundingDINO_SwinT_OGC (694MB)",
    "seed": -1,
    "sampler": "DPM++ 2M SDE Karras",
    "steps": 20,
    "box_threshold": 0.3,
    "mask_expand": 35,
    "mask_blur": 4,
    "cfg_scale": 5.5,
    "denoise": 1,
    "inpainting_mask_invert": False,
    "upscaler_for_img2img": "",
    "fix_steps": False,
    "inpainting_fill": 0,
    "sd_model_checkpoint": "",
    "max_resolution_on_detection": 1280,
    "inpaint_padding": 40
}
response = requests.post(url=f'{url}replacer/replace', data=json.dumps(payload))


r = response.json()
print(response.json())        

image = Image.open(io.BytesIO(base64.b64decode(r['images'][0])))

Batch from Directory - Keep original filename

Even though "Use original name for output filename during batch process in extras tab" is checked, when using Batch from Directory within this extension, it will not keep the original filenames from the input directory for the output files, but name them "0000-12345" etc. I would really appreciate it if it could keep the original filename instead, like the Extras tab does.

I can't loading a video source. Mouse drag is not working.

Known issues. Do not open issue, if you faced with problem from the list:

ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)

You need to update automatic1111 webui. Launch git pull command inside webui root

ModuleNotFoundError: No module named 'scripts.sam'

You need to install https://github.com/continue-revolution/sd-webui-segment-anything
Do not confuse with Inpaint Anything!

sam = sam_model_registrymodel_type
KeyError: ''

Segment Anything extension currently doesn't support FastSam and Matting-Anything. Ask about this here: continue-revolution/sd-webui-segment-anything#135

how to fix this? - out_1765400657%5d-1765400657.jpg

[image2 @ 00000184b9a2b700] Could find no file with path 'C:\Users\ggrov\Downloads\out_1765400657%5d-1765400657.jpg' and index in the range 0-4
C:\Users\ggrov\Downloads\out_1765400657%5d-1765400657.jpg: No such file or directory
*** Error completing request
*** Arguments: ('task(8suv0abpbp9lbhs)', '', '', 'police uniform ', '', 3.0, None, None, '', '', False, 'C:\Users\ggrov\Downloads\1.mp4', 10, '', -1, 'DPM++ 2M SDE Karras', 20, 0.3, 35, 4, 1024, 'sam_hq_vit_l.pth', 'GroundingDINO_SwinB (938MB)', 5.5, 1, 20, 0, 512, 1, 512, 1, 0, False, []) {}
Traceback (most recent call last):
File "D:\Webui1111\stable-diffusion-portable-main\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "D:\Webui1111\stable-diffusion-portable-main\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "D:\Webui1111\stable-diffusion-portable-main\extensions\sd-webui-replacer\replacer\generate.py", line 474, in generate_webui
return generate(*args, **kwargs)
File "D:\Webui1111\stable-diffusion-portable-main\extensions\sd-webui-replacer\replacer\generate.py", line 368, in generate
save_video(output_batch_dir, fps_out, input_video, save_video_path, seed)
File "D:\Webui1111\stable-diffusion-portable-main\extensions\sd-webui-replacer\replacer\video_tools.py", line 87, in save_video
raise Exception(f'ffmpeg exited with code {rc}. See console for details')
Exception: ffmpeg exited with code 1. See console for details


No Replacer tab on screen, new issue: OutputPanel' object has no attribute 'html_info'

*** Error executing callback ui_tabs_callback for C:\SD_REPO\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py
Traceback (most recent call last):
File "C:\SD_REPO\stable-diffusion-webui\modules\script_callbacks.py", line 169, in ui_tabs_callback
res += c.callback() or []
File "C:\SD_REPO\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 310, in on_ui_tabs
html_info = outputPanel.html_info
AttributeError: 'OutputPanel' object has no attribute 'html_info'


Using SD1111 version: v1.7.0-331-gcb5b335a  •  python: 3.10.11  •  torch: 2.1.2+cu121  •  xformers: 0.0.23.post1  •  gradio: 3.41.2  •  checkpoint: d157850094

Thank you for support!

API support

Using replacer via API would be superb, is this even possible right now?

Batch issues

Hi,

When I try to use the batch function with Replacer, I get the following error:

[Replacer] Exception: [Errno 2] No such file or directory: 'E:\User\stable-diffusion-webui\outputs\replacer\2024-03-10\00005-prompts.png.tmp'

This only happens if I use Batch Process or Batch from directory. With single images it works great.
I tried to put in a custom path, but the issue remains the same.

I do think this extension is really great in general.

Please add Webui Forge support too

I tried to use the plugin on the Webui Forge release, but unfortunately I got an error that it cannot find the controlnet. The Forge edition comes with it factory installed, so you don't need to install it separately. If it helps, this is the error your extension is giving you now:

   Building wheels for collected packages: groundingdino
  Building wheel for groundingdino (setup.py): started
  Building wheel for groundingdino (setup.py): finished with status 'error'
  Running setup.py clean for groundingdino
Failed to build groundingdino

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/IDEA-Research/GroundingDINO 'C:\Users\Mykee\AppData\Local\Temp\pip-req-build-qo9bttqo'
  error: subprocess-exited-with-error

  python setup.py bdist_wheel did not run successfully.
  exit code: 1

  [94 lines of output]
  Building wheel groundingdino-0.1.0
  Compiling with CUDA
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\groundingdino
  copying groundingdino\version.py -> build\lib.win-amd64-cpython-310\groundingdino
  copying groundingdino\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino
  creating build\lib.win-amd64-cpython-310\groundingdino\config
  copying groundingdino\config\GroundingDINO_SwinB_cfg.py -> build\lib.win-amd64-cpython-310\groundingdino\config
  copying groundingdino\config\GroundingDINO_SwinT_OGC.py -> build\lib.win-amd64-cpython-310\groundingdino\config
  copying groundingdino\config\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\config
  creating build\lib.win-amd64-cpython-310\groundingdino\datasets
  copying groundingdino\datasets\cocogrounding_eval.py -> build\lib.win-amd64-cpython-310\groundingdino\datasets
  copying groundingdino\datasets\transforms.py -> build\lib.win-amd64-cpython-310\groundingdino\datasets
  copying groundingdino\datasets\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\datasets
  creating build\lib.win-amd64-cpython-310\groundingdino\models
  copying groundingdino\models\registry.py -> build\lib.win-amd64-cpython-310\groundingdino\models
  copying groundingdino\models\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\models
  creating build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\box_ops.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\get_tokenlizer.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\inference.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\logger.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\misc.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\slconfig.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\slio.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\time_counter.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\utils.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\visualizer.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\vl_utils.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  copying groundingdino\util\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\util
  creating build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\bertwarper.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\fuse_modules.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\groundingdino.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\ms_deform_attn.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\transformer.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\transformer_vanilla.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\utils.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  copying groundingdino\models\GroundingDINO\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO
  creating build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone
  copying groundingdino\models\GroundingDINO\backbone\backbone.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone
  copying groundingdino\models\GroundingDINO\backbone\position_encoding.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone
  copying groundingdino\models\GroundingDINO\backbone\swin_transformer.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone
  copying groundingdino\models\GroundingDINO\backbone\__init__.py -> build\lib.win-amd64-cpython-310\groundingdino\models\GroundingDINO\backbone
  running build_ext
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\Mykee\AppData\Local\Temp\pip-req-build-qo9bttqo\setup.py", line 204, in <module>
      setup(
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\wheel\bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\dist.py", line 963, in run_command
      super().run_command(command)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\command\build_ext.py", line 88, in run
      _build_ext.run(self)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
      self.build_extensions()
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\torch\utils\cpp_extension.py", line 525, in build_extensions
      _check_cuda_version(compiler_name, compiler_version)
    File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\system\python\lib\site-packages\torch\utils\cpp_extension.py", line 413, in _check_cuda_version
      raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda))
  RuntimeError:
  The detected CUDA version (11.8) mismatches the version that was used to compile
  PyTorch (12.1). Please make sure to use the same CUDA versions.

  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for groundingdino
ERROR: Could not build wheels for groundingdino, which is required to install pyproject.toml-based projects

GroundingDINO install failed. Will fall back to local groundingdino this time. Please permanently switch to local groundingdino on Settings/Segment Anything or submit an issue to https://github.com/IDEA-Research/Grounded-Segment-Anything/issues.
Running GroundingDINO Inference
Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB)
Initializing SAM to cuda:0
Running SAM Inference (512, 512, 3)
SAM inference with 1 box, 0 positive prompts, 0 negative prompts
Creating output image
SAM inference with 1 box, 0 positive prompts, 0 negative prompts done. However, GroundingDINO installment has failed. Your process automatically fall back to local groundingdino. Check your terminal for more detail and permanently switch to local groundingdino on Settings/Segment Anything or submit an issue to https://github.com/IDEA-Research/Grounded-Segment-Anything/issues..
Dilation Amount:  35
Dilation Amount:  35
Dilation Amount:  35
MasksCreator cached
 [Replacer]    Exception: No module named 'internal_controlnet'
*** Error completing request
*** Arguments: ('task(vsvb9gnf7ck877g)', 'man body', '', 'woman body', 'poor quality, low quality,  low res', 0.0, <PIL.Image.Image image mode=RGBA size=512x512 at 0x253AA655300>, None, True, '', '', True, False, '', '', 10, '', -1, 'DPM++ 2M SDE Karras', 20, 0.3, 35, 4, 1280, 'mobile_sam.pt', 'GroundingDINO_SwinT_OGC (694MB)', 5.5, 1, 40, 0, 512, 1, 512, 1, 0, ['script'], False, False, 'NSFW\\juggernaut_reborn.safetensors', 'Random', ['Draw mask'], None, True, ['Draw mask'], None, UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=(False,), batch_image_dir=('',), batch_input_gallery=([],), generated_image=(None,), mask_image=(None,), enabled=False, module='None', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>), UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=(False,), batch_image_dir=('',), batch_input_gallery=([],), generated_image=(None,), mask_image=(None,), enabled=False, module='None', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>), UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=(False,), batch_image_dir=('',), batch_input_gallery=([],), generated_image=(None,), mask_image=(None,), enabled=False, module='None', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>), UiControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=(False,), batch_image_dir=('',), batch_input_gallery=([],), generated_image=(None,), mask_image=(None,), enabled=False, module='None', model='None', weight=1.0, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0.0, guidance_end=1.0, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>)) {}
    Traceback (most recent call last):
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\extensions\sd-webui-replacer\replacer\generate.py", line 561, in generate_webui
        return generate(*args, **kwargs)
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\extensions\sd-webui-replacer\replacer\generate.py", line 409, in generate
        processed, extraImages = generateSingle(image, gArgs, saveDir, "", save_to_dirs,
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\extensions\sd-webui-replacer\replacer\generate.py", line 171, in generateSingle
        processed, scriptImages = inpaint(image, gArgs, savePath, saveSuffix, save_to_dirs,
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\extensions\sd-webui-replacer\replacer\generate.py", line 92, in inpaint
        replacer_scripts.enableInpaintModeForCN(gArgs.cn_args)
      File "I:\Stable-Diffusion-Automatic\stable-diffusion-webui-forge\webui\extensions\sd-webui-replacer\replacer\replacer_scripts.py", line 18, in enableInpaintModeForCN
        from internal_controlnet.external_code import get_all_units_from
    ModuleNotFoundError: No module named 'internal_controlnet'

Exception: not found, please download model to models/sam.

Hi I installed the model sam sam_hq_vit_h.pth

to the directory:

..\stable-diffusion-webui\extensions\sd-webui-segment-anything\models\sam

but i continue to get this error:

...
Exception: not found, please download model to models/sam.

Custom mask is not appended if "do not use detection prompt" is disabled

As per title, and by following instructions here I can't use the custom mask as an extension of the generated one.

Moreover while it is not clear what "upload mask" does, I can see it does replace the whole content of the image while applying the mask and achieving the result but with a subtly different source image.

tab replacer not show up

Hai,
i already install sd web ui segment anything, then i install replacer, but when i restart the A1111 server this error show up and Replacer tab not show up, any advice ?

*** Error loading script: replacer_main_ui.py
Traceback (most recent call last):
File "D:\stable-diffusion-webui\modules\scripts.py", line 382, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "D:\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\stable-diffusion-webui\extensions\sd-webui-replacer\scripts\replacer_main_ui.py", line 2, in
from modules import scripts, shared, sd_samplers, ui_toprow, ui, script_callbacks
ImportError: cannot import name 'ui_toprow' from 'modules' (unknown location)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.