2

I Run stable diffusion,It`s wrong RuntimeError: "LayerNormKernelImpl" not implemented for 'Half',help me,how i do?

I have no idea for it

吾发克
  • 31
  • 1
  • 1
  • 2

6 Answers6

7

I solved it in the following way, modify the launch.py file in the following way, add the following line of code:

commandline_args = os.environ.get('COMMANDLINE_ARGS', "--skip-torch-cuda-test --no-half")

launch.py file and the modified line of code just as stated above

Pedram
  • 921
  • 1
  • 10
  • 17
7

'LayerNorm' is one of the layers in the Model. Looks like you're trying to load the diffusion model in float16(Half) format on CPU which is not supported. For float16 format, GPU needs to be used. For CPU run the model in float32 format.

Reference: https://github.com/pytorch/pytorch/issues/52291

Manoj Mohan
  • 5,654
  • 1
  • 17
  • 21
3

I am not sure what your environment is. I can show you what I have encountered. I also encountered this error during my Colab testing, which appeared after I changed my model. Then I realized that I had forgotten to assign the pipe to CUDA. After running the code below, everything was fine.

pipe = pipe.to("cuda")
Rains
  • 31
  • 1
3

In Windows System, Edit webui-user.bat file

set COMMANDLINE_ARGS= --skip-torch-cuda-test --no-half
2

Instantiate the pipeline with float32, it will run slower but it will run ;)

pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
2

RuntimeError: “LayerNormKernelImpl” not implemented for ‘Half’

I have successfully solved this problem by way of

Start the webUI with the following Mac OS Terminal command.

cd stable-diffusion-webui ./webui.sh --precision full --no-half

Special Thank >> https://stable-diffusion-art.com/install-mac/comment-page-1/