AI大模型教程
一起来学习

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,就解决相关的问题了;

文章来源于互联网:stable-diffusion-webui出现NansException: A tensor with all NaNs was produced in Unet

相关推荐: Stable Diffusion 模型分享:Disney Pixar Cartoon Type B(迪士尼皮克斯动画片B类)

本文收录于《AI绘画从入门到精通》专栏,专栏总目录:点这里。 文章来源于互联网:Stable Diffusion 模型分享:Disney Pixar Cartoon Type B(迪士尼皮克斯动画片B类)

赞(0)
未经允许不得转载:5bei.cn大模型教程网 » stable-diffusion-webui出现NansException: A tensor with all NaNs was produced in Unet
分享到: 更多 (0)

AI大模型,我们的未来

小欢软考联系我们