Interpause / auto-sd-paint-ext

Extension for AUTOMATIC1111 to add custom backend API for Krita Plugin & more
MIT License
473 stars 43 forks source link

ERROR Exception: 'int' object is not iterable #151

Open spreck opened 1 year ago

spreck commented 1 year ago

Describe the bug Error when trying to run txt2img in Krita

To Reproduce Steps to reproduce the behavior:

  1. Install plugin in vlad's fork automatic
  2. Follow installation instructions for script in Krita
  3. run txt2img
  4. See error

Screenshots 12:27:12-499195 INFO Loading VAE weights: specified in settings: cached vae-ft-mse-840000-ema-pruned.safetensors 12:27:12-673194 INFO Applying scaled dot product cross attention optimization 12:27:13-143195 INFO Weights loaded in 1.2s (load=0.1s vae=0.7s device=0.4s) 12:27:13-758194 INFO Restoring base VAE 12:27:13-867196 INFO Applying scaled dot product cross attention optimization 12:27:14-596195 INFO VAE weights loaded: None auto-sd-paint-ext:INFO: img size: 512x512 -> 512x512, aspect ratio: 1.00 -> 1.00, 0.00% change 12:27:15-258195 ERROR Exception: 'int' object is not iterable 12:27:15-277193 ERROR Arguments: args=('', 'tensor field', '', 'None', 20, 2, False, False, 1, 1, 7.0, -1, -1, 0.0, 0, 0, False, 512, 512, False, 0.7, 0, 'None', 0, 512, 512, [], 0) kwargs={} 12:27:15-329195 ERROR gradio call: TypeError ┌────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────┐ │ C:\Users\wrg\github\automatic\modules\call_queue.py:33 in f │ │ │ │ 32 │ │ │ try: │ │ > 33 │ │ │ │ res = func(*args, **kwargs) │ │ 34 │ │ │ │ progress.record_results(id_task, res) │ │ │ │ C:\Users\wrg\github\automatic\modules\txt2img.py:19 in txt2img │ │ │ │ 18 │ │ sampler_index = 0 │ │ > 19 │ override_settings = create_override_settings_dict(override_settings_texts) │ │ 20 │ │ │ │ C:\Users\wrg\github\automatic\modules\generation_parameters_copypaste.py:341 in create_override_settings_dict │ │ │ │ 340 │ params = {} │ │ > 341 │ for pair in text_pairs: │ │ 342 │ │ k, v = pair.split(":", maxsplit=1) │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ TypeError: 'int' object is not iterable auto-sd-paint-ext:WARNING: Interrupted!

Desktop (please complete the following information):

Using VENV: C:\Users\wrg\github\automatic\venv 12:14:04-003342 INFO Running extension preloading 12:14:04-139962 INFO Starting SD.Next 12:14:04-142944 INFO Python 3.10.6 on Windows 12:14:04-293926 INFO Version: 684851ae Wed May 24 13:50:01 2023 -0400 12:14:04-841279 INFO Setting environment tuning 12:14:04-853294 INFO nVidia CUDA toolkit detected 12:14:08-286273 INFO Torch 2.0.1+cu118 12:14:08-309266 INFO Torch backend: nVidia CUDA 11.8 cuDNN 8700 12:14:08-313243 INFO Torch detected GPU: NVIDIA GeForce RTX 3060 VRAM 12287 Arch (8, 6) Cores 28 12:14:08-318249 INFO Verifying requirements 12:14:08-353267 WARNING Package wrong version: numpy 1.24.3 required 1.23.5 12:14:08-356271 INFO Installing package: numpy==1.23.5 12:14:26-350593 ERROR Error running pip: install --upgrade numpy==1.23.5 12:14:26-358590 INFO Installing packages 12:14:26-470883 INFO Running setup 12:14:26-473857 INFO Installing repositories 12:14:27-471670 INFO Installing submodules 12:14:30-870097 INFO Updating submodules 12:15:36-499374 INFO Extensions enabled: ['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR', 'Lora', 'multidiffusion-upscaler-for-automatic1111', 'prompt-bracket-checker', 'ScuNET', 'sd-dynamic-thresholding', 'sd-extension-system-info', 'sd-webui-controlnet', 'sd-webui-model-converter', 'stable-diffusion-webui-images-browser', 'stable-diffusion-webui-rembg', 'SwinIR', 'a1111-sd-webui-tagcomplete', 'auto-sd-paint-ext', 'model-keyword', 'openOutpaint', 'sd-canvas-editor', 'sd-dynamic-prompts', 'sd-webui-segment-anything', 'stable-diffusion-webui-depthmap-script', 'stable-diffusion-webui-state', 'ultimate-upscale-for-automatic1111'] 12:15:36-521394 INFO Updating Wiki 12:15:37-443349 WARNING Setup complete with errors: 1 12:15:37-446393 WARNING See log file for more details: setup.log 12:15:37-449383 INFO Running extension preloading 12:15:37-453347 INFO Server arguments: ['--models-dir', 'C:\Users\wrg\github\stable-diffusion-webui1\models', '--listen'] No module 'xformers'. Proceeding without it. 12:15:53-207450 INFO Libraries loaded 12:15:53-214443 INFO Using data path: C:\Users\wrg\github\automatic 12:15:53-227440 INFO Available VAEs: C:\Users\wrg\github\stable-diffusion-webui1\models\VAE 3 12:15:53-374424 INFO Available models: C:\Users\wrg\github\stable-diffusion-webui1\models\Stable-diffusion 48 12:16:00-148392 INFO Setting Torch parameters: dtype=torch.float16 vae=torch.float16 unet=torch.float16

Rogal80 commented 1 year ago

Have the same problem in Vladmandic. Can someone help?

Rogal80 commented 1 year ago

solved temporarily adding 3x # in app.py :

"", # img2img_batch_input_dir (unspported)

    #"",  # img2img_batch_output_dir (unsupported)
    #"",  # img2img_batch_inpaint_mask_dir (unsupported):

if req.is_inpaint else 0, # mode (we use 0 (img2img with init_img) & 4 (inpaint uploaded mask)) parse_prompt(req.prompt), # prompt parse_prompt(req.negative_prompt), # negative_prompt "None", # prompt_styles: saved prompt styles (unsupported) image, # init_img None, # sketch (unused by us) None, # init_img_with_mask (unused by us) None, # inpaint_color_sketch (unused by us) None, # inpaint_color_sketch_orig (unused by us) image, # init_img_inpaint mask, # init_mask_inpaint req.steps, # steps get_sampler_index(req.sampler_name), # sampler_index 0, # req.mask_blur, # mask_blur None, # mask_alpha (unused by us) # only used by webUI color sketch if init_img_with_mask isn't dict req.inpainting_fill, # inpainting_fill req.restore_faces, # restore_faces req.tiling, # tiling req.batch_count, # n_iter req.batch_size, # batch_size req.cfg_scale, # cfg_scale 0, # img_cfg_scale (unsupported) req.clip_skip, # clip_skip <<<<< here req.denoising_strength, # denoising_strength req.seed, # seed req.subseed, # subseed req.subseed_strength, # subseed_strength req.seed_resize_from_h, # seed_resize_from_h req.seed_resize_from_w, # seed_resize_from_w req.seed_enable_extras, # seed_enable_extras 0, # selected_scale_tab height, # height width, # width 1.0, # scale_by req.resize_mode, # resize_mode False, # req.inpaint_full_res, # inpaint_full_res 0, # req.inpaint_full_res_padding, # inpaint_full_res_padding req.invert_mask, # inpainting_mask_invert

"", # img2img_batch_input_dir (unspported) ------------------------------- here

    #"",  # img2img_batch_output_dir (unsupported) ------------------------------- here
    #"",  # img2img_batch_inpaint_mask_dir (unsupported) ------------------------------- here
    get_sampler_index(req.sampler_name), # hr_sampler_index
    "", # hr_prompt
    "", # hr_negative_prompt
    [],  # override_settings_texts (unsupported)
    *args,
wauterboi commented 1 year ago

@Rogal80,

Your code was added to the img2img section, which does indeed fix img2img. What about txt2img?

Miraihi commented 1 year ago

Temporary solution here.

TL. DR. - Add req.clip_skip, # right on the next line after req.cfg_scale at txt2img output and on the next line after req.cfg_scale, # cfg_scale for img2img output at auto-sd-paint-ext\backend\app.py.