lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.45k stars 825 forks source link

IP-Adapter 无法显示模型[Bug]: #694

Open aiisoft opened 6 months ago

aiisoft commented 6 months ago

Checklist

What happened?

通过打印GLOBAL_MODELS_DIR = os.path.join(folder_paths.models_dir, "ipadapter") 输出的值来判断IP-Adapter的模型应该是在:D:\webui_forge\webui\models\ipadapter 但 IP-Adapter模型列表依然是空白的.

Steps to reproduce the problem

1.D:\webui_forge\webui\extensions-builtin\sd_forge_ipadapter\lib_ipadapter\IPAdapterPlus.py 2.在GLOBAL_MODELS_DIR = os.path.join(folder_paths.models_dir, "ipadapter")下方插入Print(GLOBAL_MODELS_DIR) 3.重启webui_forge并在控制台内查看GLOBAL_MODELS_DIR的路径值 4.将IPAdapter模型拷贝进D:\webui_forge\webui\models\ipadapter 5.重启webui_forge 6.ControlNet 单元 0 [IP-Adapter] 模型列表显示为No 屏幕截图 2024-04-27 190133 屏幕截图 2024-04-27 190231 ne

What should have happened?

列出ipadapter模型选择

What browsers do you use to access the UI ?

Microsoft Edge

Sysinfo

Windows

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
Launching Web UI with arguments:
Total VRAM 24564 MB, total RAM 32450 MB
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4060 : 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
Using pytorch cross attention
ControlNet preprocessor location: D:\webui_forge\webui\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.4.0, num models: 10
sd-webui-prompt-all-in-one background API service started successfully.
Loading weights [19c1008761] from D:\webui_forge\webui\models\Stable-diffusion\SD1.5\breakdro_A959.safetensors
2024-04-27 19:05:10,496 - ControlNet - INFO - ControlNet UI callback registered.
model_type EPS
UNet ADM Dimension 0
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

To create a public link, set `share=True` in `launch()`.
extra {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'}
left over keys: dict_keys(['model_ema.decay', 'model_ema.num_updates'])
loaded straight to GPU
To load target model BaseModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  21280.03662109375
[Memory Management] Model Memory (MB) =  0.00762939453125
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  20256.02899169922
Startup time: 74.3s (prepare environment: 2.1s, import torch: 2.5s, import gradio: 0.6s, setup paths: 0.7s, other imports: 0.5s, load scripts: 61.5s, create ui: 1.0s, gradio launch: 2.6s, app_started_callback: 2.5s).
Moving model(s) has taken 1.18 seconds
Loading VAE weights specified in settings: D:\webui_forge\webui\models\VAE\sdxl_vae.safetensors
To load target model SD1ClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  21279.78466796875
[Memory Management] Model Memory (MB) =  454.2076225280762
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  19801.577045440674
Moving model(s) has taken 0.23 seconds
Model loaded in 7.3s (load weights from disk: 0.2s, forge load real models: 6.0s, load VAE: 0.7s, calculate empty prompt: 0.4s).

Additional information

No response

aibaby1991 commented 5 months ago

the error

  File "extensions-builtin/sd_forge_ipadapter/lib_ipadapter/IPAdapterPlus.py", line 22, in <module>
    GLOBAL_MODELS_DIR = os.path.join(folder_paths.models_dir, "ipadapter")

I found this error too, few things can fix it 1. mkdir models\ipadapter copy the item model to models\ipadapter code fix @

  1. edit and fix this file /extensions-builtin/sd_forge_ipadapter/lib_ipadapter/IPAdapterPlus.py line 22 GLOBAL_MODELS_DIR = os.path.join(folder_paths.models_dir, "ipadapter") is read the models dir + ipadapter

but in the file models_dir is None /ldm_patched/utils/path_utils.py

this program code is not write complete, so return None by models_dir!

need to fix it!