lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
7.72k stars 741 forks source link

[Bug]: The instandID feature is not functioning properly in CN,KeyError: 1 #723

Open ssymgatf1 opened 4 months ago

ssymgatf1 commented 4 months ago

Checklist

What happened?

Previously, the instantid feature was working properly, but about a week ago it became unable to display images normally, lacking a preview image for controlling the position of the face. QQ图片20240511145414 This error occasionally resolves itself. The instantid feature may become operational again at any time, but when you attempt to use it next, it might not function properly again.

Steps to reproduce the problem

1.Open ForgeUI. 2.Set up image parameters and prompt words. 3.Set the cn instantid parameters 4.Start generating. 5.Generation failed.

What should have happened?

The instantid feature is capable of generating images normally when it is functioning properly

What browsers do you use to access the UI ?

Google Chrome, Microsoft Edge

Sysinfo

sysinfo-2024-05-11-07-00.json

Console logs

Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f0.0.17v1.8.0rc-latest-276-g29be1da7
Commit hash: 29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7
is_installed check for tensorflow-cpu failed as 'spec is None'
Installing requirements for easyphoto-webui
Installing requirements for tensorflow
CUDA 12.1
loading WD14-tagger reqs from L:\forgeUI\webui\extensions\stable-diffusion-webui-wd14-tagger\requirements.txt
Checking WD14-tagger requirements.
Launching Web UI with arguments: --theme dark
Total VRAM 12281 MB, total RAM 32702 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4070 Ti : native
Hint: your device supports --pin-shared-memory for potential speed improvements.
Hint: your device supports --cuda-malloc for potential speed improvements.
Hint: your device supports --cuda-stream for potential speed improvements.
VAE dtype: torch.bfloat16
CUDA Stream Activated:  False
2024-05-11 14:29:54.505247: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-05-11 14:29:55.342652: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
Using pytorch cross attention
ControlNet preprocessor location: L:\forgeUI\webui\models\ControlNetPreprocessor
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
2024-05-11 14:30:04,960 - modelscope - INFO - PyTorch version 2.1.2+cu121 Found.
2024-05-11 14:30:04,965 - modelscope - INFO - TensorFlow version 2.16.1 Found.
2024-05-11 14:30:04,965 - modelscope - INFO - Loading ast index from L:\forgeUI\webui\.cache\modelscope\ast_indexer
2024-05-11 14:30:05,062 - modelscope - INFO - Loading done! Current index file version is 1.9.3, with md5 2e450686f115302eeaec7e5c167febf8 and a total number of 943 components indexed
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
sd-webui-prompt-all-in-one background API service started successfully.
14:30:09 - ReActor - STATUS - Running v0.7.0-b7 on Device: CUDA
== WD14 tagger /gpu:0, uname_result(system='Windows', node='小admin', release='10', version='10.0.22621', machine='AMD64') ==
Loading weights [c8df560d29] from L:\forgeUI\webui\models\Stable-diffusion\XL juggernautXL_v9Rdphoto2Lightning.safetensors
AnimateDiffScript init
AnimateDiffScript init
2024-05-11 14:30:13,649 - ControlNet - INFO - ControlNet UI callback registered.
model_type EPS
UNet ADM Dimension 2816
[tag-editor] Custom taggers loaded: ['aesthetic shadow', 'cafeai aesthetic classifier', 'Improved Aesthetic Predictor', 'wd aesthetic classifier']
Running on local URL:  http://127.0.0.1:7860
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
extra {'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.transformer.text_model.embeddings.position_ids', 'cond_stage_model.clip_g.logit_scale', 'cond_stage_model.clip_l.logit_scale'}
To load target model SDXLClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  10759.99609375
[Memory Management] Model Memory (MB) =  2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  7591.641395568848
Moving model(s) has taken 0.41 seconds
Model loaded in 10.4s (load weights from disk: 1.2s, forge instantiate config: 1.7s, forge load real models: 6.8s, calculate empty prompt: 0.6s).

To create a public link, set `share=True` in `launch()`.
IIB Database file has been successfully backed up to the backup folder.
Startup time: 57.1s (prepare environment: 12.4s, import torch: 3.8s, import gradio: 1.0s, setup paths: 3.7s, initialize shared: 0.1s, other imports: 0.6s, load scripts: 14.4s, create ui: 3.7s, gradio launch: 16.8s, app_started_callback: 0.3s).
2024-05-11 14:47:43,835 - ControlNet - INFO - ControlNet Input Mode: InputMode.SIMPLE
2024-05-11 14:47:43,837 - ControlNet - INFO - Using preprocessor: InsightFace (InstantID)
2024-05-11 14:47:43,838 - ControlNet - INFO - preprocessor resolution = 0.5
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: L:\forgeUI\webui\models\insightface\models\antelopev2\1k3d68.onnx landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: L:\forgeUI\webui\models\insightface\models\antelopev2\2d106det.onnx landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: L:\forgeUI\webui\models\insightface\models\antelopev2\genderage.onnx genderage ['None', 3, 96, 96] 0.0 1.0
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: L:\forgeUI\webui\models\insightface\models\antelopev2\glintr100.onnx recognition ['None', 3, 112, 112] 127.5 127.5
Applied providers: ['CPUExecutionProvider'], with options: {'CPUExecutionProvider': {}}
find model: L:\forgeUI\webui\models\insightface\models\antelopev2\scrfd_10g_bnkps.onnx detection [1, 3, '?', '?'] 127.5 128.0
set det-size: (640, 640)
Warning torch.load doesn't support weights_only on this pytorch version, loading unsafely.
2024-05-11 14:47:46,222 - ControlNet - INFO - Current ControlNet IPAdapterPatcher: L:\forgeUI\webui\models\ControlNet\ip-adapter_instant_id_sdxl.bin
2024-05-11 14:47:46,222 - ControlNet - INFO - ControlNet Input Mode: InputMode.SIMPLE
*** Error running process: L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
    Traceback (most recent call last):
      File "L:\forgeUI\webui\modules\scripts.py", line 803, in process
        script.process(p, *script_args)
      File "L:\forgeUI\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 548, in process
        self.process_unit_after_click_generate(p, unit, params, *args, **kwargs)
      File "L:\forgeUI\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 298, in process_unit_after_click_generate
        input_list, resize_mode = self.get_input_data(p, unit, preprocessor, h, w)
      File "L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 203, in get_input_data
        resize_mode = external_code.resize_mode_from_value(p.resize_mode)
    AttributeError: 'StableDiffusionProcessingTxt2Img' object has no attribute 'resize_mode'

---
2024-05-11 14:47:49,931 - ControlNet - INFO - ControlNet Method InsightFace (InstantID) patched.
*** Error running process_before_every_sampling: L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
    Traceback (most recent call last):
      File "L:\forgeUI\webui\modules\scripts.py", line 835, in process_before_every_sampling
        script.process_before_every_sampling(p, *script_args, **kwargs)
      File "L:\forgeUI\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 555, in process_before_every_sampling
        self.process_unit_before_every_sampling(p, unit, self.current_params[i], *args, **kwargs)
    KeyError: 1

---
To load target model SDXL
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  8110.9638671875
[Memory Management] Model Memory (MB) =  4897.086494445801
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  2189.877372741699
Moving model(s) has taken 1.27 seconds
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:03<00:00,  2.88it/s]
To load target model AutoencoderKL█████████████████████████████████████████████████████| 10/10 [00:02<00:00,  3.26it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  4866.4677734375
[Memory Management] Model Memory (MB) =  159.55708122253418
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  3682.910692214966
Moving model(s) has taken 0.98 seconds
*** Error running postprocess_batch_list: L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py
    Traceback (most recent call last):
      File "L:\forgeUI\webui\modules\scripts.py", line 859, in postprocess_batch_list
        script.postprocess_batch_list(p, pp, *script_args, **kwargs)
      File "L:\forgeUI\system\python\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "L:\forgeUI\webui\extensions-builtin\sd_forge_controlnet\scripts\controlnet.py", line 561, in postprocess_batch_list
        self.process_unit_after_every_sampling(p, unit, self.current_params[i], pp, *args, **kwargs)
    KeyError: 1

---
Cleanup minimal inference memory.
Total progress: 100%|██████████████████████████████████████████████████████████████████| 10/10 [00:07<00:00,  1.32it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 10/10 [00:07<00:00,  3.26it/s]

Additional information

I have tried uninstalling all plugins, and even downloading a new ForgeUI, but the issue with instantID not being usable intermittently persists. To address this, I have updated my PC system and graphics card drivers, and also deleted the instantID model, but none of these actions have been able to consistently reproduce or resolve the problem. Currently, out of 10 attempts to generate images, instantID fails to function properly 9 times. Even when instantID is successfully invoked, it may lose functionality at any moment and throw an error