问题一
在使用图生图时,报错
NansException: A tensor with all NaNs was produced in Unet. This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the "Upcast cross attention layer to float32" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use --disable-nan-check commandline argument to disable this check.
解决方案一(我单独改了这个没生效):
1、web页面修改配置:
Settings > Stable Diffusion
应用设置,重新加载
解决方案二(这种只适合windows 部署的):
另一种解决方法–no-half是从选项开始。
将 webui-user.bat 文件更改为:
更改前的 webui-user.bat (示例)
@echo off
set GIT_PYTHON_REFRESH=quiet
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=
call webui.bat
COMMANDLINE_ARGS=–no-half添加
更改 webui-user.bat 后(示例)
@echo off
set GIT_PYTHON_REFRESH=quiet
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--no-half
call webui.bat
解决方案三:
1、在执行启动命令前,设置环境变量
export COMMANDLINE_ARGS="--xformers --no-half-vae"
2、再执行启动命令
./SD_start.sh
我还修改过这个脚本,但是没生效,不知道是不是改错地方了,stable-diffusion-webui 目录下有个webui-user.sh 文件,stable-diffusion-webui/stable-diffusion-webui/ 下
也有个webui-user.sh 文件,我改的是下面这个目录下的 文件,没生效,最终还是在终端设置环境变量再启动,才生效了
vim stable-diffusion-webui/stable-diffusion-webui/webui-user.sh +13
问题二:
(使用SDXLRonghua_v11.safetensors 模型报错)
OutOfMemoryError: CUDA out of memory. Tried to allocate 3.96 GiB (GPU 0; 15.75 GiB total capacity; 6.81 GiB already allocated; 3.74 GiB free; 10.99 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
1、在执行启动命令前,设置环境变量
export COMMANDLINE_ARGS="--xformers --no-half-vae"
2、再执行启动命令
./SD_start.sh