AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.04k stars 26.52k forks source link

[Bug]: RuntimeError: "LayerNormKernelImpl" not implemented for 'Half' #8773

Open fengyu-ycq opened 1 year ago

fengyu-ycq commented 1 year ago

Is there an existing issue for this?

What happened?

I try to generate an image using txt2img and it keeps responding with RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

Steps to reproduce the problem

  1. Go to stable diffusion webui
  2. Press generate

What should have happened?

generate image

Commit where the problem happens

a9fed7c

What platforms do you use to access the UI ?

MacOS

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

set COMMANDLINE_ARGS==--skip-torch-cuda-test --precision full --no-half

List of extensions

no

Console logs

Error completing request
Arguments: ('task(6shqb1d4qetl6ts)', 'a beautifule chinese girl', '', [], 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 0, False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0) {}
Traceback (most recent call last):
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/processing.py", line 625, in process_images_inner
    uc = get_conds_with_caching(prompt_parser.get_learned_conditioning, negative_prompts, p.steps, cached_uc)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/processing.py", line 570, in get_conds_with_caching
    cache[1] = function(shared.sd_model, required_prompts, steps)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/prompt_parser.py", line 140, in get_learned_conditioning
    conds = model.get_learned_conditioning(texts)
  File "/Users/chengqiangyi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 669, in get_learned_conditioning
    c = self.cond_stage_model(c)
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/sd_hijack_clip.py", line 229, in forward
    z = self.process_tokens(tokens, multipliers)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/sd_hijack_clip.py", line 254, in process_tokens
    z = self.encode_with_transformers(tokens)
  File "/Users/chengqiangyi/stable-diffusion-webui/modules/sd_hijack_open_clip.py", line 28, in encode_with_transformers
    z = self.wrapped.encode_with_transformer(tokens)
  File "/Users/chengqiangyi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/encoders/modules.py", line 177, in encode_with_transformer
    x = self.text_transformer_forward(x, attn_mask=self.model.attn_mask)
  File "/Users/chengqiangyi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/encoders/modules.py", line 189, in text_transformer_forward
    x = r(x, attn_mask=attn_mask)
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/open_clip/transformer.py", line 154, in forward
    x = x + self.ls_1(self.attention(self.ln_1(x), attn_mask=attn_mask))
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/open_clip/transformer.py", line 27, in forward
    x = F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps)
  File "/Users/chengqiangyi/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/functional.py", line 2503, in layer_norm
    return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled)
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'

Additional information

No response

LinuxBeaver commented 1 year ago

I can't get the text to image to run because of this. Can someone help?

Nevercomes commented 1 year ago

+1

Nevercomes commented 1 year ago

Oh, I explored other issues like this one, you can add export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half" in your web-user.sh because of you are in macos. At least, it worked for me.

VGTiredAF commented 1 year ago

Im having the same issue though but with windows 11

ACGNnsj commented 1 year ago

Hi, I ran with this problem too. However, I found it out of my personal mistake. I set NVIDIA_VISIBLE_DEVICES to 1 aiming to block the intergrated graphics card, which caused my nvidia gpu not detected.

yookiChen commented 1 year ago

Is this problem solved? I have the same problem

Saqib-diar commented 7 months ago

I have faced the same problem, and here is the solution, first do this inside your launch.py: commandline_args = os.environ.get('COMMANDLINE_ARGS', "") commandline_args = os.environ.get('COMMANDLINE_ARGS', "--skip-torch-cuda-test --no-half")

and then run the below command ./webui.sh --precision full --no-half