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.71k stars 423 forks source link

[Issue]: RuntimeError during generation with custom model #175

Closed jurandfantom closed 1 year ago

jurandfantom commented 1 year ago

Issue Description

During attempt of generate picture (text2img) with custom model, following error appear and generation not happens: "RuntimeError: Input type (struct c10::Half) and bias type (float) should be the same"

Steps:

Version Platform Description

Windows 10 image


I would ask community - but it point out to automatic1111 repo (with i never had such error with a1111).

I expect that might have something with VAE half or float ( --no-half-vae ? ) but prefer to ask here to fully understand error information and how fix that isse.

Bonus: Where i need add --update ? I see .bat file (windows) have way more content than bat for automatic1111 - project page description not specify that to well "Update is not performed by default, enable with --upgrade flag" - where enable ? or how to enable?

vladmandic commented 1 year ago

please fill platform description as required. set title to something that describes it. describe how did you end up there. and post traceback in the issue itself, not title.

jurandfantom commented 1 year ago

Edited.

vladmandic commented 1 year ago

does this happen with this specific model only or any model? if its specific one, please post a link. and post full traceback, single line RuntimeError: Input type (struct c10::Half) and bias type (float) should be the same is not sufficient to troubleshoot.

regarding --upgrade, see #134, #138

jurandfantom commented 1 year ago

Any model. I switched OFF VAE in settings (none), but error appear still as it was.

Regarding trackback (include start of automatic and change one model to another ): 23,04,16 - 16,39,42 - 7643 a

vladmandic commented 1 year ago

screenshot does not help and is not readable. post text as (includes triple-left-quotes as below):

``` text ```

jurandfantom commented 1 year ago

You can click image and it will appear in full resolution, but sure if that is better - took a while to restart and run everything once again, sorry for delay :) (ps. thanks for point out about --update, when I try find such issue, there was no search results for "--update" )

venv "E:\Magazyn\Grafika\AI\Vladmandic\automatic\venv\Scripts\Python.exe"
17:03:06-443122 INFO     Python 3.10.9 on Windows
17:03:06-652619 INFO     Running setup
17:03:06-758124 INFO     Version: b7e4b041 Sun Apr 16 10:01:28 2023 -0400
17:03:07-430122 INFO     Latest available version: b7e4b0414a1ad9cf9d4b8010a7b48cbc55249533 2023-04-16T14:01:28Z
17:03:07-434124 INFO     Updating Wiki
17:03:10-095124 INFO     Installing requirements
17:03:10-800660 INFO     Installing packages
17:03:10-804621 INFO     Installing repositories
17:03:11-329621 INFO     Installing submodules
17:03:13-476121 INFO     Updating submodules
17:03:34-795622 INFO     Extensions enabled: ['a1111-sd-webui-lycoris', 'clip-interrogator-ext', 'LDSR', 'Lora',
                         'model-keyword', 'multidiffusion-upscaler-for-automatic1111', 'prompt-bracket-checker',
                         'ScuNET', 'sd-dynamic-thresholding', 'sd-extension-aesthetic-scorer',
                         'sd-extension-steps-animation', 'sd-extension-system-info', 'sd-webui-controlnet',
                         'sd-webui-model-converter', 'seed_travel', 'stable-diffusion-webui-images-browser',
                         'stable-diffusion-webui-rembg', 'SwinIR']
17:04:33-937619 INFO     Extensions enabled: ['asymmetric-tiling-sd-webui', 'canvas-zoom',
                         'infinite-zoom-automatic1111-webui', 'openpose-editor', 'sd-canvas-editor',
                         'sd-dynamic-prompts', 'sd-webui-3d-open-pose-editor', 'sd-webui-additional-networks',
                         'sd-webui-ar', 'sd-webui-aspect-ratio-helper', 'sd-webui-llul',
                         'sd-webui-multiple-hypernetworks', 'sd-webui-panorama-viewer', 'sd-webui-regional-prompter',
                         'sd_grid_add_image_number', 'stable-diffusion-NPW', 'Stable-Diffusion-Webui-Civitai-Helper',
                         'stable-diffusion-webui-model-toolkit', 'stable-diffusion-webui-promptgen',
                         'stable-diffusion-webui-Prompt_Generator', 'stable-diffusion-webui-sonar',
                         'stable-diffusion-webui-text2prompt', 'stable-diffusion-webui-wildcards', 'StylePile',
                         'test_my_prompt', 'ultimate-upscale-for-automatic1111']
17:05:18-394621 INFO     Setting environment tuning
17:05:21-122122 INFO     Torch 2.0.0+cu118
17:05:21-145628 INFO     Torch backend: nVidia CUDA 11.8 cuDNN 8700
17:05:21-149622 INFO     Torch detected GPU: NVIDIA GeForce RTX 4090 VRAM 24563 Arch (8, 9) Cores 128
17:05:21-154625 INFO     Server arguments: []
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: E:\Magazyn\Grafika\AI\Vladmandic\automatic\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
[AddNet] Updating model hashes...
0it [00:00, ?it/s]
Hypernetwork-MonkeyPatch-Extension not found
loading script: multiple_hypernetworks.py: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\scripts.py:255 in load_scripts                                   │
│                                                                                                                     │
│   254 │   │   │                                                                                                     │
│ > 255 │   │   │   script_module = script_loading.load_module(scriptfile.path)                                       │
│   256 │   │   │   register_scripts_from_module(script_module)                                                       │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\script_loading.py:9 in load_module                               │
│                                                                                                                     │
│    8 │   module = importlib.util.module_from_spec(module_spec)                                                      │
│ >  9 │   module_spec.loader.exec_module(module)                                                                     │
│   10                                                                                                                │
│                                                                                                                     │
│                                               ... 1 frames hidden ...                                               │
│ in _call_with_frames_removed:241                                                                                    │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\extensions\sd-webui-multiple-hypernetworks\scripts\multiple_hypernetwork │
│ s.py:46 in <module>                                                                                                 │
│                                                                                                                     │
│    45                                                                                                               │
│ >  46 if shared.cmd_opts.xformers or shared.cmd_opts.force_enable_xformers:                                         │
│    47 │   try:                                                                                                      │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'Namespace' object has no attribute 'xformers'
[text2prompt] Following databases are available:
    all-mpnet-base-v2 : danbooru_strict
Loading theme: black-orange
[text2prompt] Loading database with name "all-mpnet-base-v2 : danbooru_strict"...
[text2prompt] Database loaded
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Loading weights: E:\Magazyn\Grafika\AI\Automatic1111\stable-diffusion-webui\models\Stable-diffusion\Anime\Ani_04_Mell…
Creating model from config: E:\Magazyn\Grafika\AI\Vladmandic\automatic\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying scaled dot product cross attention optimization
embedding load Neg_EasyNegative.pt: UnpicklingError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\textual_inversion\textual_inversion.py:206 in load_from_dir      │
│                                                                                                                     │
│   205 │   │   │   │   │                                                                                             │
│ > 206 │   │   │   │   │   self.load_from_file(fullfn, fn)                                                           │
│   207 │   │   │   │   except Exception as e:                                                                        │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\textual_inversion\textual_inversion.py:157 in load_from_file     │
│                                                                                                                     │
│   156 │   │   elif ext in ['.BIN', '.PT']:                                                                          │
│ > 157 │   │   │   data = torch.load(path, map_location="cpu")                                                       │
│   158 │   │   elif ext in ['.SAFETENSORS']:                                                                         │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\venv\lib\site-packages\torch\serialization.py:815 in load                │
│                                                                                                                     │
│    814 │   │   │   │   raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None                              │
│ >  815 │   │   return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args                     │
│    816                                                                                                              │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\venv\lib\site-packages\torch\serialization.py:1033 in _legacy_load       │
│                                                                                                                     │
│   1032 │                                                                                                            │
│ > 1033 │   magic_number = pickle_module.load(f, **pickle_load_args)                                                 │
│   1034 │   if magic_number != MAGIC_NUMBER:                                                                         │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
UnpicklingError: invalid load key, '<'.
Embeddings loaded: badhandv4, bad_prompt_version2, By bad artist -neg, By bad artist anime -neg, easynegative, Neg_badhands, Neg_bitugly,Neg_DeepNegative, Neg_EasyNegative, neg_facelift512, neg_grapefruit, neg_realism512, Neg_superugly, Neg_useembeddingname, Unspeakable-Horrors-24v, verybadimagenegative_v1.3, charturnerv2, durer-style,
hrgiger-drmacabre, piotr-jablonski, Style-Empire, Style-Glorious, Style-Hamunaptra, style-sylvamagic, Ulzzang-6500
(Korean doll aesthetic) (49)
Textual inversion embeddings skipped(1): nrealfixer
Model loaded in 10.2s (load=0.5s create=6.7s apply=0.9s vae=0.6s move=0.9s embeddings=0.6s)
2023-04-16 17:06:50,197 | INFO | E:\Magazyn\Grafika\AI\Vladmandic\automatic\extensions\sd-dynamic-prompts\sd_dynamic_prompts\dynamic_prompting.py | Prompt matrix will create 1 images in a total of 1 batches.
File E:\Magazyn\Grafika\AI\Vladmandic\automatic\extensions\stable-diffusion-webui-wildcards\wildcards\apple.txt not found for the __apple__ wildcard.
gradio call: FileNotFoundError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\call_queue.py:59 in f                                            │
│                                                                                                                     │
│    58 │   │   │   │   pr.enable()                                                                                   │
│ >  59 │   │   │   res = list(func(*args, **kwargs))                                                                 │
│    60 │   │   │   if shared.cmd_opts.profile:                                                                       │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\modules\call_queue.py:38 in f                                            │
│                                                                                                                     │
│    37 │   │   │   try:                                                                                              │
│ >  38 │   │   │   │   res = func(*args, **kwargs)                                                                   │
│    39 │   │   │   finally:                                                                                          │
│                                                                                                                     │
│                                               ... 5 frames hidden ...                                               │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\venv\lib\site-packages\torch\serialization.py:271 in _open_file_like     │
│                                                                                                                     │
│    270 │   if _is_path(name_or_buffer):                                                                             │
│ >  271 │   │   return _open_file(name_or_buffer, mode)                                                              │
│    272 │   else:                                                                                                    │
│                                                                                                                     │
│ E:\Magazyn\Grafika\AI\Vladmandic\automatic\venv\lib\site-packages\torch\serialization.py:252 in __init__            │
│                                                                                                                     │
│    251 │   def __init__(self, name, mode):                                                                          │
│ >  252 │   │   super().__init__(open(name, mode))                                                                   │
│    253                                                                                                              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
FileNotFoundError: [Errno 2] No such file or directory:
'E:\\Magazyn\\Grafika\\AI\\Vladmandic\\automatic\\models\\VAE-approx\\model.pt'
vladmandic commented 1 year ago

You can click image and it will appear in full resolution, but sure if that is better

if you post a screenshot, i cannot select text and search for it. it makes it 10x more work for developers.

issue is in bad coding in extension sd-webui-multiple-hypernetworks - it reads command line params for xformers instead of checking if xformers are actually available or not.

i'll add a compatibility layer for that, so it "just works" (eta ~1h), but in reality it should be fixed by extension author. in the meantime, you can uninstall the extension

this is same as it was previously reported for a different extension and author fixed it promptly: https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111/issues/130

off-topic, not sure why do you need that extension at all, functionality is pretty much built-in already?

jurandfantom commented 1 year ago

off-topic: Just setup your distro yesterday and installed plugins that i had in my automatic1111 and I know I use. maybe it was added and plugin is not needed anymore - never knew that (thanks for info, one less to load).

Thanks for explanation what was wrong - gonna try hunt future errors by looking for similar looking things. Will remove plugin asap.