light-and-ray / sd-webui-replacer

A tab for sd-webui for replacing objects in pictures or videos using detection prompt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please add Webui Forge support too

mykeehu opened this issue · comments

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'

It already support, you need to update the extension. You didn't update so far

Perfect working, I tested. Thank you!