stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

RuntimeError: expected scalar type Half but found Float

Open thehappydinoa opened this issue 2 years ago • 2 comments

Describe the bug

I ran a txt2img and got this exception using PLMS.

To Reproduce

  1. I went into text to image
  2. I typed in my prompt
  3. Ran it and got this exception.

Exception

Error completing request
Arguments: ('acacia bush on fire in the infinite desert, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski', '', 'None', 'None', 20, 7, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, False, 0.7, 0, False, None, '', False, 1, '', 4, '', True, False) {}
Traceback (most recent call last):
  File "C:\Users\theha\GitHub\stable-diffusion-webui\modules\ui.py", line 142, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\theha\GitHub\stable-diffusion-webui\webui.py", line 60, in f
    res = func(*args, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\modules\txt2img.py", line 41, in txt2img
    processed = process_images(p)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\modules\processing.py", line 351, in process_images
    uc = prompt_parser.get_learned_conditioning(len(prompts) * [p.negative_prompt], p.steps)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\modules\prompt_parser.py", line 104, in get_learned_conditioning
    conds = shared.sd_model.get_learned_conditioning(texts)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\repositories\stable-diffusion\ldm\models\diffusion\ddpm.py", line 558, in get_learned_conditioning
    c = self.cond_stage_model(c)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\modules\sd_hijack.py", line 387, in forward
    outputs = self.wrapped.transformer(input_ids=tokens)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 722, in forward
    return self.text_model(
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 643, in forward
    encoder_outputs = self.encoder(
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 574, in forward
    layer_outputs = encoder_layer(
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 317, in forward
    hidden_states, attn_weights = self.self_attn(
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\theha\GitHub\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 257, in forward
    attn_output = torch.bmm(attn_probs, value_states)
RuntimeError: expected scalar type Half but found Float

Desktop (please complete the following information):

  • OS: Windows 11 22H2 22621.521
  • Browser: Brave
  • Commit revision: 278e7c711411bfc0a8bcf6c7f3d09f27d329c7a0

Additional context

I just pull after a day or two so I believe it something related to that or k-diffusion being updated.

thehappydinoa avatar Sep 28 '22 18:09 thehappydinoa

Adding --no-half option to main.py worked for me.

okaits avatar Nov 06 '22 05:11 okaits

where mighten one find main.py... i dont appear to have one

ahward21 avatar Nov 28 '22 21:11 ahward21

Oh, sorry, it's webui.py, not main.py.

okaits avatar Dec 17 '22 18:12 okaits

Outdated.

mezotaken avatar Jan 16 '23 18:01 mezotaken

Still getting this error on some 2.1 models on 22bcc7be428c94e9408f589966c2040187245d81 on Macbook M1Max machines

Mozoloa avatar Apr 17 '23 19:04 Mozoloa