当前位置:   article > 正文

stable-diffusion-webui出现NansException: A tensor with all NaNs was produced in Unet_a tensor with all nans was produced in unet. this

a tensor with all nans was produced in unet. this could be either because th

环境:秋叶大佬的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()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/779954
推荐阅读
相关标签
  

闽ICP备14008679号