vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.68k stars 421 forks source link

[Issue]: AttributeError: module 'modules.sd_models' has no attribute 'model_hash' #3536

Closed ChiaYen-Kan closed 2 days ago

ChiaYen-Kan commented 2 days ago

Issue Description

after update 41f9a3508696e90bda5e4c61ff4b767414decdc3 is show "AttributeError: module 'modules.sd_models' has no attribute 'model_hash'"

Version Platform Description

Platform: cpu: AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD (amd ryzen 5 5600g without other gpu) system: Windows release: Windows-10-10.0.19045-SP0 python: 3.11.9

Backend: directml

Version 41f9a3508696e90bda5e4c61ff4b767414decdc3

Browser: Firefox 131

Relevant log output

Using VENV: C:\AI\automatic\venv
12:13:09-851135 INFO     Starting SD.Next
12:13:09-851135 INFO     Logger: file="C:\AI\automatic\sdnext.log" level=DEBUG size=65 mode=create
12:13:09-866761 INFO     Python: version=3.11.9 platform=Windows bin="C:\AI\automatic\venv\Scripts\python.exe"
                         venv="C:\AI\automatic\venv"
12:13:10-067294 INFO     Version: app=sd.next updated=2024-10-29 hash=41f9a350 branch=master
                         url=https://github.com/vladmandic/automatic.git/tree/master ui=main
12:13:10-871456 INFO     Platform: arch=AMD64 cpu=AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD system=Windows
                         release=Windows-10-10.0.19045-SP0 python=3.11.9
12:13:10-875457 DEBUG    Setting environment tuning
12:13:10-877457 DEBUG    Torch allocator: "garbage_collection_threshold:0.80,max_split_size_mb:512"
12:13:10-884459 DEBUG    Torch overrides: cuda=False rocm=False ipex=False directml=True openvino=False zluda=False
12:13:10-886459 INFO     DirectML: selected
12:13:11-077502 INFO     Verifying requirements
12:13:11-081504 INFO     Verifying packages
12:13:11-131514 DEBUG    Timestamp repository update time: Wed Oct 30 03:35:58 2024
12:13:11-132515 INFO     Startup: standard
12:13:11-134516 INFO     Verifying submodules
12:13:14-224961 DEBUG    Git detached head detected: folder="extensions-builtin/sd-extension-chainner" reattach=main
12:13:14-224961 DEBUG    Git submodule: extensions-builtin/sd-extension-chainner / main
12:13:14-356483 DEBUG    Git detached head detected: folder="extensions-builtin/sd-extension-system-info" reattach=main
12:13:14-356483 DEBUG    Git submodule: extensions-builtin/sd-extension-system-info / main
12:13:14-441122 DEBUG    Git submodule: extensions-builtin/sd-webui-agent-scheduler / main
12:13:14-557014 DEBUG    Git detached head detected: folder="extensions-builtin/sdnext-modernui" reattach=main
12:13:14-572641 DEBUG    Git submodule: extensions-builtin/sdnext-modernui / main
12:13:14-710668 DEBUG    Git detached head detected: folder="extensions-builtin/stable-diffusion-webui-rembg"
                         reattach=master
12:13:14-710668 DEBUG    Git submodule: extensions-builtin/stable-diffusion-webui-rembg / master
12:13:14-843050 DEBUG    Git detached head detected: folder="modules/k-diffusion" reattach=master
12:13:14-845051 DEBUG    Git submodule: modules/k-diffusion / master
12:13:14-964079 DEBUG    Git detached head detected: folder="wiki" reattach=master
12:13:14-967078 DEBUG    Git submodule: wiki / master
12:13:15-050098 DEBUG    Register paths
12:13:15-134117 DEBUG    Installed packages: 234
12:13:15-136117 DEBUG    Extensions all: ['Lora', 'sd-extension-chainner', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
                         'stable-diffusion-webui-rembg']
12:13:15-295153 DEBUG    Extension installer: C:\AI\automatic\extensions-builtin\sd-extension-system-info\install.py
12:13:15-454190 DEBUG    Extension installer: C:\AI\automatic\extensions-builtin\sd-webui-agent-scheduler\install.py
12:13:17-806699 DEBUG    Extension force: name="sd-webui-controlnet" commit=ecd33eb
12:13:17-875277 DEBUG    Extension installer: C:\AI\automatic\extensions-builtin\sd-webui-controlnet\install.py
12:13:30-144296 DEBUG    Extension installer:
                         C:\AI\automatic\extensions-builtin\stable-diffusion-webui-images-browser\install.py
12:13:32-439957 DEBUG    Extension installer:
                         C:\AI\automatic\extensions-builtin\stable-diffusion-webui-rembg\install.py
12:13:40-879134 DEBUG    Extensions all: ['adetailer', 'ultimate-upscale-for-automatic1111']
12:13:40-881135 DEBUG    Extension force: name="adetailer" commit=a89c01d
12:13:40-933146 DEBUG    Extension installer: C:\AI\automatic\extensions\adetailer\install.py
12:13:41-202207 INFO     Extensions enabled: ['Lora', 'sd-extension-chainner', 'sd-extension-system-info',
                         'sd-webui-agent-scheduler', 'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
                         'stable-diffusion-webui-rembg', 'adetailer', 'ultimate-upscale-for-automatic1111']
12:13:41-206213 INFO     Verifying requirements
12:13:41-208210 DEBUG    Setup complete without errors: 1730261621
12:13:41-216565 DEBUG    Extension preload: {'extensions-builtin': 0.0, 'extensions': 0.0}
12:13:41-218565 DEBUG    Starting module: <module 'webui' from 'C:\\AI\\automatic\\webui.py'>
12:13:41-221566 INFO     Command line args: ['--use-directml', '--models-dir', 'C:/AI/Models', '--debug']
                         models_dir=C:/AI/Models use_directml=True debug=True
12:13:41-224568 DEBUG    Env flags: []
12:13:47-419417 INFO     System packages: {'torch': '2.4.1+cpu', 'diffusers': '0.32.0.dev0', 'gradio': '3.43.2',
                         'transformers': '4.46.0', 'accelerate': '1.0.1'}
12:13:48-021035 DEBUG    Huggingface cache: folder="C:\Users\ChiaYen\.cache\huggingface\hub"
12:13:48-067913 INFO     Device detect: memory=8.0 optimization=medvram
12:13:48-067913 DEBUG    Read: file="config.json" json=47 bytes=2064 time=0.000
12:13:48-074417 DEBUG    Unknown settings: ['save_images_before_face_restoration', 'ad_save_images_before',
                         'ad_max_models', 'ad_same_seed_for_each_tap', 'ad_bbox_sortby', 'multiple_tqdm',
                         'diffusers_seq_cpu_offload']
12:13:48-074417 INFO     Engine: backend=Backend.ORIGINAL compute=directml device=privateuseone:0
                         attention="Sub-quadratic" mode=no_grad
12:13:48-074417 WARNING  Backend=original is in maintainance-only mode
12:13:48-074417 DEBUG    Read: file="html\reference.json" json=59 bytes=31175 time=0.000
12:13:48-136925 INFO     Torch override: no-half dtype=torch.float32
12:13:48-152550 INFO     Torch parameters: backend=directml device=privateuseone:0 config=Auto dtype=torch.float32
                         vae=torch.float32 unet=torch.float32 context=no_grad nohalf=True nohalfvae=False upscast=True
                         deterministic=False test-fp16=True test-bf16=False optimization="Sub-quadratic"
12:13:48-321829 DEBUG    Importing LDM
12:13:48-475471 DEBUG    ONNX: version=1.19.2 provider=DmlExecutionProvider, available=['DmlExecutionProvider',
                         'CPUExecutionProvider']
12:13:48-575733 DEBUG    ONNX failed to initialize XL pipelines: module 'optimum.onnxruntime.modeling_diffusion' has no
                         attribute 'ORTPipelinePart'
12:13:48-575733 INFO     Device: device=AMD Radeon(TM) Graphics n=1 directml=0.2.5.dev240914
12:13:48-638239 DEBUG    Entering start sequence
12:13:48-653865 INFO     Using models path: C:/AI/Models
12:13:48-653865 DEBUG    Initializing
12:13:48-754139 INFO     Available VAEs: path="C:/AI/Models\VAE" items=10
12:13:48-769763 INFO     Available UNets: path="C:/AI/Models\UNET" items=0
12:13:48-769763 INFO     Available TEs: path="C:/AI/Models\Text-encoder" items=0
12:13:48-769763 INFO     Disabled extensions: ['sdnext-modernui']
12:13:48-776268 DEBUG    Read: file="cache.json" json=2 bytes=11723 time=0.000
12:13:48-776268 DEBUG    Read: file="metadata.json" json=308 bytes=718711 time=0.000
12:13:48-794014 INFO     Available Models: path="C:/AI/Models\Stable-diffusion" items=43 time=0.02
12:13:48-858575 INFO     Available Yolo: path="C:/AI/Models\yolo" items=6 downloaded=0
12:13:48-858575 DEBUG    Load extensions
12:13:49-092386 INFO     Extension: script='extensions-builtin\Lora\scripts\lora_script.py'
                         12:13:48-938713 INFO     Available LoRAs: items=136
                         folders=2
12:13:49-493436 INFO     Extension: script='extensions-builtin\sd-webui-agent-scheduler\scripts\task_scheduler.py'
                         Using sqlite file: extensions-builtin\sd-webui-agent-scheduler\task_scheduler.sqlite3
12:13:49-609343 INFO     Extension: script='extensions-builtin\sd-webui-controlnet\scripts\api.py' ControlNet
                         preprocessor location:
                         C:\AI\automatic\extensions-builtin\sd-webui-controlnet\annotator\downloads
12:13:49-869560 ERROR    Module load: extensions-builtin\sd-webui-controlnet\scripts\controlnet.py: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\AI\automatic\modules\script_loading.py:25 in load_module                                                         │
│                                                                                                                     │
│   24 │   │   │   │   with contextlib.redirect_stdout(io.StringIO()) as stdout:                                      │
│ > 25 │   │   │   │   │   module_spec.loader.exec_module(module)                                                     │
│   26 │   │   │   setup_logging() # reset since scripts can hijaack logging                                          │
│ in exec_module:940                                                                                                  │
│ in _call_with_frames_removed:241                                                                                    │
│                                                                                                                     │
│ C:\AI\automatic\extensions-builtin\sd-webui-controlnet\scripts\controlnet.py:87 in <module>                         │
│                                                                                                                     │
│     86                                                                                                              │
│ >   87 global_state.update_cn_models()                                                                              │
│     88                                                                                                              │
│                                                                                                                     │
│ C:\AI\automatic\extensions-builtin\sd-webui-controlnet\scripts\global_state.py:245 in update_cn_models              │
│                                                                                                                     │
│   244 │   │   filter_by = shared.opts.data.get("control_net_models_name_filter", "")                                │
│ > 245 │   │   found = get_all_models(sort_by, filter_by, path)                                                      │
│   246 │   │   cn_models.update({**found, **cn_models})                                                              │
│                                                                                                                     │
│ C:\AI\automatic\extensions-builtin\sd-webui-controlnet\scripts\global_state.py:229 in get_all_models                │
│                                                                                                                     │
│   228 │   │   if name != "None":                                                                                    │
│ > 229 │   │   │   res[name + f" [{sd_models.model_hash(filename)}]"] = filename                                     │
│   230                                                                                                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: module 'modules.sd_models' has no attribute 'model_hash'
12:13:49-957698 INFO     Extension: script='extensions-builtin\sd-webui-controlnet\scripts\hook.py' Warning: ControlNet
                         failed to load SGM - will use LDM instead.
12:13:50-627871 INFO     Extension: script='extensions\adetailer\scripts\!adetailer.py' [-] ADetailer initialized.
                         version: 24.5.1, num models: 25
12:13:50-627871 DEBUG    Extensions init time: 1.77 Lora=0.18 sd-webui-agent-scheduler=0.34 sd-webui-controlnet=0.49
                         adetailer=0.62
12:13:50-643497 DEBUG    Read: file="html/upscalers.json" json=4 bytes=2640 time=0.000
12:13:50-643497 DEBUG    Read: file="extensions-builtin\sd-extension-chainner\models.json" json=24 bytes=2693
                         time=0.000
12:13:50-643497 DEBUG    chaiNNer models: path="C:/AI/Models\chaiNNer" defined=24 discovered=0 downloaded=2
12:13:50-659123 INFO     Available Upscalers: items=50 downloaded=13 user=0 time=0.03 types=['None', 'Lanczos',
                         'Nearest', 'ChaiNNer', 'AuraSR', 'ESRGAN', 'LDSR', 'RealESRGAN', 'SCUNet', 'SD', 'SwinIR']
12:13:50-681254 INFO     Available Styles: folder="C:/AI/Models/styles" items=77 time=0.02
12:13:50-681254 DEBUG    Creating UI
12:13:50-681254 DEBUG    UI themes available: type=Standard themes=12
12:13:50-681254 INFO     UI theme: type=Standard name="black-teal"
12:13:50-696884 DEBUG    UI theme: css="C:\AI\automatic\javascript\black-teal.css" base="sdnext.css" user="None"
12:13:50-696884 DEBUG    UI initialize: txt2img
12:13:50-781518 DEBUG    Networks: page='model' items=46 subfolders=5 tab=txt2img
                         folders=['C:/AI/Models\\Stable-diffusion', 'models\\Reference',
                         'C:\\AI\\Models\\Stable-diffusion'] list=0.06 thumb=0.02 desc=0.05 info=0.02 workers=8
                         sort=Default
12:13:50-802279 DEBUG    Networks: page='lora' items=136 subfolders=15 tab=txt2img folders=['C:/AI/Models\\Lora',
                         'C:/AI/Models\\LyCORIS'] list=0.07 thumb=0.02 desc=0.13 info=0.02 workers=8 sort=Default
12:13:50-811282 DEBUG    Networks: page='style' items=77 subfolders=2 tab=txt2img folders=['C:/AI/Models/styles',
                         'html'] list=0.06 thumb=0.03 desc=0.00 info=0.00 workers=8 sort=Default
12:13:50-820283 DEBUG    Networks: page='embedding' items=26 subfolders=0 tab=txt2img
                         folders=['C:/AI/Models\\embeddings'] list=0.05 thumb=0.00 desc=0.02 info=0.00 workers=8
                         sort=Default
12:13:50-827285 DEBUG    Networks: page='vae' items=10 subfolders=0 tab=txt2img folders=['C:/AI/Models\\VAE'] list=0.05
                         thumb=0.03 desc=0.00 info=0.00 workers=8 sort=Default
12:13:50-833286 DEBUG    Networks: page='history' items=0 subfolders=0 tab=txt2img folders=[] list=0.00 thumb=0.00
                         desc=0.00 info=0.00 workers=8 sort=Default
12:13:50-859292 ERROR    Calling script: extensions\adetailer\scripts\!adetailer.py/ui: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\AI\automatic\modules\scripts.py:301 in wrap_call                                                                 │
│                                                                                                                     │
│   300 │   try:                                                                                                      │
│ > 301 │   │   res = func(*args, **kwargs)                                                                           │
│   302 │   │   return res                                                                                            │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\scripts\!adetailer.py:140 in ui                                                │
│                                                                                                                     │
│    139 │   │                                                                                                        │
│ >  140 │   │   components, infotext_fields = adui(num_models, is_img2img, webui_info)                               │
│    141                                                                                                              │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:156 in adui                                                       │
│                                                                                                                     │
│   155 │   │   │   │   with gr.Tab(ordinal(n + 1)):                                                                  │
│ > 156 │   │   │   │   │   state, infofields = one_ui_group(                                                         │
│   157 │   │   │   │   │   │   n=n,                                                                                  │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:259 in one_ui_group                                               │
│                                                                                                                     │
│   258 │   with gr.Group():                                                                                          │
│ > 259 │   │   controlnet(w, n, is_img2img)                                                                          │
│   260                                                                                                               │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:640 in controlnet                                                 │
│                                                                                                                     │
│   639 │   eid = partial(elem_id, n=n, is_img2img=is_img2img)                                                        │
│ > 640 │   cn_models = ["None", "Passthrough", *get_cn_models()]                                                     │
│   641                                                                                                               │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\controlnet_ext\controlnet_ext.py:158 in get_cn_models                          │
│                                                                                                                     │
│   157 │   if controlnet_exists:                                                                                     │
│ > 158 │   │   return _get_cn_models()                                                                               │
│   159 │   return []                                                                                                 │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\controlnet_ext\controlnet_ext.py:150 in _get_cn_models                         │
│                                                                                                                     │
│   149 │   for p in model_paths:                                                                                     │
│ > 150 │   │   model_hash = sd_models.model_hash(p)                                                                  │
│   151 │   │   name = f"{p.stem} [{model_hash}]"                                                                     │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: module 'modules.sd_models' has no attribute 'model_hash'
12:13:51-037333 DEBUG    UI initialize: img2img
12:13:51-075341 ERROR    Calling script: extensions\adetailer\scripts\!adetailer.py/ui: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\AI\automatic\modules\scripts.py:301 in wrap_call                                                                 │
│                                                                                                                     │
│   300 │   try:                                                                                                      │
│ > 301 │   │   res = func(*args, **kwargs)                                                                           │
│   302 │   │   return res                                                                                            │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\scripts\!adetailer.py:140 in ui                                                │
│                                                                                                                     │
│    139 │   │                                                                                                        │
│ >  140 │   │   components, infotext_fields = adui(num_models, is_img2img, webui_info)                               │
│    141                                                                                                              │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:156 in adui                                                       │
│                                                                                                                     │
│   155 │   │   │   │   with gr.Tab(ordinal(n + 1)):                                                                  │
│ > 156 │   │   │   │   │   state, infofields = one_ui_group(                                                         │
│   157 │   │   │   │   │   │   n=n,                                                                                  │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:259 in one_ui_group                                               │
│                                                                                                                     │
│   258 │   with gr.Group():                                                                                          │
│ > 259 │   │   controlnet(w, n, is_img2img)                                                                          │
│   260                                                                                                               │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\aaaaaa\ui.py:640 in controlnet                                                 │
│                                                                                                                     │
│   639 │   eid = partial(elem_id, n=n, is_img2img=is_img2img)                                                        │
│ > 640 │   cn_models = ["None", "Passthrough", *get_cn_models()]                                                     │
│   641                                                                                                               │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\controlnet_ext\controlnet_ext.py:158 in get_cn_models                          │
│                                                                                                                     │
│   157 │   if controlnet_exists:                                                                                     │
│ > 158 │   │   return _get_cn_models()                                                                               │
│   159 │   return []                                                                                                 │
│                                                                                                                     │
│ C:\AI\automatic\extensions\adetailer\controlnet_ext\controlnet_ext.py:150 in _get_cn_models                         │
│                                                                                                                     │
│   149 │   for p in model_paths:                                                                                     │
│ > 150 │   │   model_hash = sd_models.model_hash(p)                                                                  │
│   151 │   │   name = f"{p.stem} [{model_hash}]"                                                                     │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: module 'modules.sd_models' has no attribute 'model_hash'
12:13:51-327398 DEBUG    Read: file="ui-config.json" json=46 bytes=2066 time=0.000
12:13:51-376409 DEBUG    UI themes available: type=Standard themes=12
12:13:53-093136 DEBUG    Extension list: processed=396 installed=10 enabled=9 disabled=1 visible=396 hidden=0
12:13:53-214164 DEBUG    Root paths: ['C:\\AI\\automatic']
12:13:53-293548 INFO     Local URL: http://127.0.0.1:7860/
12:13:53-294545 DEBUG    Gradio functions: registered=1978
12:13:53-297546 DEBUG    FastAPI middleware: ['Middleware', 'Middleware']
12:13:53-300547 DEBUG    Creating API
12:13:53-452557 INFO     [AgentScheduler] Task queue is empty
12:13:53-454558 INFO     [AgentScheduler] Registering APIs
12:13:53-856648 DEBUG    Scripts setup: ['XYZ Grid:0.012', 'ADetailer:0.285']
12:13:53-858648 DEBUG    Model metadata: file="metadata.json" no changes
12:13:53-859649 DEBUG    Model auto load disabled
12:13:53-861649 DEBUG    Script callback init time: image_browser.py:ui_tabs=0.58 system-info.py:app_started=0.05
                         task_scheduler.py:app_started=0.42
12:13:53-863649 DEBUG    Save: file="config.json" json=47 bytes=2004 time=0.002
12:13:53-865651 INFO     Startup time: 12.63 torch=4.50 gradio=1.10 diffusers=0.44 libraries=1.37 samplers=0.12
                         extensions=1.77 detailer=0.06 ui-networks=0.19 ui-txt2img=0.18 ui-img2img=0.19
                         ui-settings=0.13 ui-extensions=1.66 ui-defaults=0.06 launch=0.13 api=0.09 app-started=0.47
12:13:53-869651 DEBUG    Unused settings: ['save_images_before_face_restoration', 'multiple_tqdm',
                         'diffusers_seq_cpu_offload']
12:13:59-881788 DEBUG    Server: alive=True jobs=0 requests=1 uptime=12 memory=0.73/31.87 backend=Backend.ORIGINAL
                         state=idle

Backend

Original

UI

Standard

Branch

Master

Model

StableDiffusion 1.5

Acknowledgements

vladmandic commented 2 days ago

will be fixed tomorrow

vladmandic commented 2 days ago

fixed in dev, i'll refresh master later today.