NansException: A tensor with all NaNs was produced in Unet. This could be either because there‘s not

最近下载个XL模型,用图生图时提示 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,找了一堆方法,最终有个是成功,在次马上(这个方法其实是把xformers禁掉,渲图会用CPU而且时间翻了几倍,最好还是把xformers安装好才是解决办法的根本)

·打开根目录stable-diffusion-webui,找到webui.bat右击打开编辑

在set ERROR_REPORTING=FALSE  下面加入以下一行保存重启
set COMMANDLINE_ARGS=--no-half --disable-nan-check

@echo off

if not defined PYTHON (set PYTHON=python)
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")

set SD_WEBUI_RESTART=tmp/restart
set ERROR_REPORTING=FALSE
set COMMANDLINE_ARGS=--no-half --disable-nan-check

mkdir tmp 2>NUL

%PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
if %ERRORLEVEL% == 0 goto :check_pip
echo Couldn't launch python
goto :show_stdout_stderr


:check_pip
%PYTHON% -mpip --help >tmp/stdout.txt 2>tmp/stderr.txt
if %ERRORLEVEL% == 0 goto :start_venv
if "%PIP_INSTALLER_LOCATION%" == "" goto :show_stdout_stderr
%PYTHON% "%PIP_INSTALLER_LOCATION%" >tmp/stdout.txt 2>tmp/stderr.txt
if %ERRORLEVEL% == 0 goto :start_venv
echo Couldn't install pip
goto :show_stdout_stderr

你可能感兴趣的:(python,开发语言,人工智能作画,windows)