Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"LayerNormKernelImpl" not implemented for 'Half' #887

Closed
Zaidbaidadekalb opened this issue Sep 22, 2022 · 9 comments
Closed

"LayerNormKernelImpl" not implemented for 'Half' #887

Zaidbaidadekalb opened this issue Sep 22, 2022 · 9 comments
Labels
bug Report of a confirmed bug

Comments

@Zaidbaidadekalb
Copy link

"LayerNormKernelImpl" not implemented for 'Half'

@Zaidbaidadekalb Zaidbaidadekalb added the bug Report of a confirmed bug label Sep 22, 2022
@dfaker
Copy link
Collaborator

dfaker commented Sep 22, 2022

Do we have any additional context around this error? Do we have a fuller error text or a description of what you were attempting?

@dfaker
Copy link
Collaborator

dfaker commented Sep 23, 2022

Closing pending actual description and reproduction steps:

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows, Linux]
  • Browser [e.g. chrome, safari]
  • Graphics Card
  • Commit revision [looks like this: e684845; can be seen when launching webui.bat, or obtained manually by running git rev-parse HEAD]

Additional context
Add any other context about the problem here.

@dfaker dfaker closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2022
@azrael511
Copy link

For @Zaidbaidadekalb and others experiencing the same issue, I reproduced this when attempting to run with cpu-only. I was able to fix it in my case by adding --no-half to COMMANDLINE_ARGS:

Describe the bug:
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half' when attempting to generate with --skip-torch-cuda-test

To Reproduce

  • With a fresh install
  • Add COMMANDLINE_ARGS=--skip-torch-cuda-test
  • Run webui-user.bat
  • Open webui
  • Hit roll or enter prompt
  • Click generate
  • See error

Expected behavior
StableDiffusion generates an image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox
  • Graphics Card: RTX 580
  • Commit revision: 1a03536

Additional context:

txt2img: Charles Blackman
C:\Users\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\torch\amp\autocast_mode.py:198: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
  warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
Error completing request
Arguments: ('Charles Blackman', '', 'None', 'None', 20, 0, 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) {}
Traceback (most recent call last):
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\modules\ui.py", line 134, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\webui.py", line 59, in f
    res = func(*args, **kwargs)
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\modules\txt2img.py", line 41, in txt2img
    processed = process_images(p)
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\modules\processing.py", line 333, in process_images
    uc = prompt_parser.get_learned_conditioning(len(prompts) * [p.negative_prompt], p.steps)
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\modules\prompt_parser.py", line 104, in get_learned_conditioning
    conds = shared.sd_model.get_learned_conditioning(texts)
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\modules\sd_hijack.py", line 374, in forward
    outputs = self.wrapped.transformer(input_ids=tokens)
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 722, in forward
    return self.text_model(
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 643, in forward
    encoder_outputs = self.encoder(
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 574, in forward
    layer_outputs = encoder_layer(
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\transformers\models\clip\modeling_clip.py", line 316, in forward
    hidden_states = self.layer_norm1(hidden_states)
  File "C:\Users\Azrael511\Git\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\Azrael511\Git\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\normalization.py", line 189, in forward
    return F.layer_norm(
  File "C:\Users\Azrael511\Git\stable-diffusion-webui\venv\lib\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'

@Zaidbaidadekalb
Copy link
Author

Thank you it looks like it works btw this is my pc specs
OS: Windows 11
Cpu: Intel(R) Core(TM) i7-8650u CPU @ 1.90GHz
Ram: 16gb
SSD: 1tb
GPU:Inter(R) UHD Graphics 620
And the Browser i use is Chrome

@dfaker
Copy link
Collaborator

dfaker commented Sep 23, 2022

Makes sense no half should indeed always be used when attempting inference on the cpu.

@xversion1
Copy link

@azrael511
Sorry to ask this but I'm not sure to ask "--no-half" to where? I mean which file?

@Sphinxxxx
Copy link

@xversion1 See these two other issues dealing with the same problem: #1349 and #5232
What worked for me was to add the arguments to the startup command:

./webui.sh --skip-torch-cuda-test --precision full --no-half

@FUTURE-GATES
Copy link

@xversion1 See these two other issues dealing with the same problem: #1349 and #5232 What worked for me was to add the arguments to the startup command:

./webui.sh --skip-torch-cuda-test --precision full --no-half

So, how to add the startup command?

@Sphinxxxx
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of a confirmed bug
Projects
None yet
Development

No branches or pull requests

6 participants