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

avatar
作者
筋斗云
阅读量:0

环境:秋叶大佬的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,就解决相关的问题了;

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!