Reputation: 261
I Run stable diffusion,It`s wrong RuntimeError: "LayerNormKernelImpl" not implemented for 'Half',help me,how i do?
I have no idea for it
Upvotes: 25
Views: 70571
Reputation: 87
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")
If you have done it already and still not working then you need to run the below command
./webui.sh --precision full --no-half
Upvotes: 0
Reputation: 1992
In newer versions of the A1111 WebUI you can add the needed arguments to webui-user.sh
# Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention"
export COMMANDLINE_ARGS="--skip-torch-cuda-test --no-half"
Upvotes: 1
Reputation: 41
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/
Upvotes: 4
Reputation: 91
Instantiate the pipeline with float32
, it will run slower but it will run ;)
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
Upvotes: 9
Reputation: 59
In Windows System, Edit webui-user.bat file
set COMMANDLINE_ARGS= --skip-torch-cuda-test --no-half
Upvotes: 5
Reputation: 6044
'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
Upvotes: 30
Reputation: 191
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")
Upvotes: 19
Reputation: 111
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")
Upvotes: 11