lllyasviel / lllyasviel/stable-diffusion-webui-forge

[Bug]: Fix IMG2IMG Alternative Test Script to Work with SDXL

Open
#589 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Checklist
  • The issue exists after disabling all extensions
  • The issue exists on a clean installation of webui
  • The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • The issue exists in the current version of the webui
  • The issue has not been reported before recently
  • The issue has been reported before but has not been fixed yet
What happened?

Script does not work with any SDXL checkpoint. This tool is honestly one of the best tools to date for animation. You can use it to prestylize frames then send them through AnimateDiff for clean up. It's incredible and DESPERATLY NEEDS TO WORK FOR SDXL <3

image

Steps to reproduce the problem
  1. Unroll Scripts tab in img2img
  2. activate Img2Img alternative test
  3. Press generate
What should have happened?

It's my understanding that this script flips the sigmas such that the diffusion process runs in reverse to generate noise from a source image.
Works perfectly fine with 1.5 checkpoints and produces incredible outputs. Works fine in ComfyUI but unfortunately comfy cannot compete with Forge / auto1111 's image generation and as such having this script work for SDXL would allow me to pre process all of my images with Forge instead of comfy.

What browsers do you use to access the UI ?

No response

Sysinfo

sysinfo-2024-03-21-03-21.json

Console logs
venv "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Launching Web UI with arguments:
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
ControlNet preprocessor location: C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2024-03-20 21:16:01,875 - ControlNet - INFO - ControlNet v1.1.441
2024-03-20 21:16:01,938 - ControlNet - INFO - ControlNet v1.1.441
Loading weights [354b8c571d] from C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\models\Stable-diffusion\15\aamAnyloraAnimeMixAnime_v1.safetensors
2024-03-20 21:16:02,190 - ControlNet - INFO - ControlNet UI callback registered.
Creating model from config: C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7861

To create a public link, set `share=True` in `launch()`.
Startup time: 7.4s (prepare environment: 1.6s, import torch: 2.7s, import gradio: 0.7s, setup paths: 0.6s, initialize shared: 0.2s, other imports: 0.3s, load scripts: 0.6s, create ui: 0.4s, gradio launch: 0.2s).
Applying attention optimization: Doggettx... done.
Model loaded in 2.4s (load weights from disk: 0.4s, create model: 0.2s, apply weights to model: 1.5s, load textual inversion embeddings: 0.1s, calculate empty prompt: 0.1s).
Reusing loaded model 15\aamAnyloraAnimeMixAnime_v1.safetensors [354b8c571d] to load XL\aamXLAnimeMix_v10.safetensors [d48c2391e0]
Loading weights [d48c2391e0] from C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\models\Stable-diffusion\XL\aamXLAnimeMix_v10.safetensors
Creating model from config: C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\repositories\generative-models\configs\inference\sd_xl_base.yaml
Applying attention optimization: Doggettx... done.
Model loaded in 5.8s (create model: 0.6s, apply weights to model: 4.7s, apply half(): 0.2s, move model to device: 0.1s, calculate empty prompt: 0.1s).
  0%|                                                                                           | 0/50 [00:00<?, ?it/s]
*** Error completing request
*** Arguments: ('task(ws73ws3603iw4cz)', 0, '', '', [], <PIL.Image.Image image mode=RGBA size=1024x1024 at 0x1CBA5A0F910>, None, None, None, None, None, None, 20, 'Euler', 4, 0, 1, 1, 1, 7, 1.5, 0.75, 0.0, 1024, 1024, 1, 0, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x000001CBA5A2BE50>, 1, False, 1, 0.5, 4, 0, 0.5, 2, False, '', 0.8, -1, False, -1, 0, 0, 0, UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', inpaint_crop_input_image=False, hr_option='Both', save_detected_map=True, advanced_weighting=None), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', inpaint_crop_input_image=False, hr_option='Both', save_detected_map=True, advanced_weighting=None), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', inpaint_crop_input_image=False, hr_option='Both', save_detected_map=True, advanced_weighting=None), '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, True, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, 'start', '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 0, False, None, None, False, None, None, False, None, None, False, 50) {}
    Traceback (most recent call last):
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\img2img.py", line 233, in img2img
        processed = modules.scripts.scripts_img2img.run(p, *args)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\scripts.py", line 766, in run
        processed = script.run(p, *script_args)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\scripts\img2imgalt.py", line 216, in run
        processed = processing.process_images(p)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\processing.py", line 785, in process_images
        res = process_images_inner(p)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 59, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\modules\processing.py", line 921, 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:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\scripts\img2imgalt.py", line 188, in sample_extra
        rec_noise = find_noise_for_image_sigma_adjustment(p, cond, uncond, cfg, st)
      File "C:\Users\infer\OneDrive\Documents\Auto1111\stable-diffusion-webui\scripts\img2imgalt.py", line 85, in find_noise_for_image_sigma_adjustment
        cond_in = torch.cat([uncond, cond])
    TypeError: expected Tensor as element 0 in argument 0, but got dict

---
Additional information

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the img2img Scripts tab with an SDXL checkpoint, then inspect scripts/img2imgalt.py, especially find_noise_for_image_sigma_adjustment and sample_extra. Use the traceback to follow the conditioning values reaching torch.cat. Done means Img2Img Alternative Test generates successfully with SDXL while continuing to work with 1.5 checkpoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.