当前位置: 代码网 > 科技>操作系统>Windows > stable-diffusion-webui出现NansException: A tensor with all NaNs was produced in Unet

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

2024年08月01日 Windows 我要评论
sd-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,就解决相关的问题了;

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com