本地搭建Stable diffusion启动后无法打开,如何解决?

本地搭建Stable diffusion,到最后一步,启动成功没有报错,但是访问http://127.0.0.1:7860,页面一直是loading状态,无法打开主页面。

img

img

  • 你可以参考下这篇文章:AI绘图风格对照表/画风样稿详细研究记录及经验总结(分析Midjourney和Stable Diffusion风格提示词实际使用情况)不断更新中...
  • 除此之外, 这篇博客: 爱做梦的人工智能「Stabled Diffusion」中的 2.4.2 模型载入 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • if fp_mode == "fp32":
        print("使用全精度推理大小为 512*512 以上的图像时需要占用超过12GB的运行内存")
        model_id = "./models/snapshots/fdd29747e61912eb941322ef6f592ae6d0e0de19"
        if not os.path.isdir(model_id):
            model_id = "CompVis/stable-diffusion-v1-4"
        if sd_mode == "DDIM":
            scheduler = DDIMScheduler(beta_start=0.00085,
                                      beta_end=0.012, 
                                      beta_schedule="scaled_linear",
                                      clip_sample=False,
                                      set_alpha_to_one=False)
        elif sd_mode == "PNDM":
            scheduler = PNDMScheduler.from_config(model_id,
                                                  subfolder="scheduler",
                                                  use_auth_token=True)
        else:
            print("Current sd_mode only support DDIM or PNDM")
            sys.exit()
    
        pipe = StableDiffusionImgToImgPipeline.from_pretrained(model_id,
                                                               scheduler=scheduler,
                                                               use_auth_token=True).to(device)
    
    elif fp_mode == "fp16":
        print("使用半精度推理大小为 512*512 以上的图像时需要占用超过10GB的运行内存")
        model_id = "./models/snapshots/a304b1ab1b59dd6c3ba9c40705c29c6de4144096"
        if not os.path.isdir(model_id):
            model_id = "CompVis/stable-diffusion-v1-4"
        if sd_mode == "DDIM":
            scheduler = DDIMScheduler(beta_start=0.00085,
                                      beta_end=0.012,
                                      beta_schedule="scaled_linear",
                                      clip_sample=False,
                                      set_alpha_to_one=False)
        elif sd_mode == "PNDM":
            scheduler = PNDMScheduler.from_config(model_id,
                                                  subfolder="scheduler",
                                                  use_auth_token=True)
        else:
            print("Current sd_mode only support DDIM or PNDM")
            sys.exit()
    
        pipe = StableDiffusionImgToImgPipeline.from_pretrained(model_id,
                                                               scheduler=scheduler,
                                                               revision="fp16",
                                                               torch_dtype=torch.float16,
                                                               use_auth_token=True).to(device)