最近下载个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
文章讲述了作者在使用XL模型进行图生图时遇到NansException,通过禁用xformers并调整设置(如设置ERROR_REPORTING和DISABLE_NAN_CHECK)解决了问题,但建议保持xformers以优化性能。
2万+

被折叠的 条评论
为什么被折叠?



