stable-diffusion-webui出现NansException: A tensor with all NaNs was produced in Unet

环境:秋叶大佬的stable-diffusion-webui启动器
操作系统:windows11
问题描述,当我更新了webui的版本以及更新了一些插件后跑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. 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

解决办法:
打开stable-diffusion-webui的根目录,然后打开launch.py,修改如下:

def main():
    import sys   #添加这行
    sys.argv.append("--no-half") # 添加这行
    if args.dump_sysinfo:
        filename = launch_utils.dump_sysinfo()
        print(f"Sysinfo saved as {filename}. Exiting...")
        exit(0)
    launch_utils.startup_timer.record("initial startup")
    with launch_utils.startup_timer.subcategory("prepare environment"):
        if not args.skip_prepare_environment:
            prepare_environment()
    if args.test_server:
        configure_for_tests()
    start()

if __name__ == "__main__":
    main()

添加如上两行代码,然后重启stable-diffusion-webui,就解决相关的问题了;

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值