InvokeAI: [bug]: Failed to load sd-1:main:unet model

Is there an existing issue for this?

  • I have searched the existing issues

OS

macOS

GPU

cpu

VRAM

16GB

What version did you experience this issue on?

3.0.1

What happened?

I’m encountering a persistent issue when trying to use the Unified Canvas in combination with various inpainting models. Specifically, every time I attempt to load an inpainting model onto the mask layer of the Unified Canvas, I receive the following error message: “Failed to load sd-1:main:unet model”.

I’ve tested this problem across multiple inpainting models, including dreamshaper_8Inpainting.safetensors, epicrealism_pureEvolutionV3-inpainting.safetensors, and epicrealism_v10.0-inpainting.safetensors. For these models, the error persists regardless of whether they are installed through the UI or the terminal.

I’ve also attempted to clear some RAM to ensure that this wasn’t a memory-related issue, but it had no effect on the problem at hand. I’m on a 2021 14" MacBook Pro with an M1 Pro processor and 16GB of unified memory.

Interestingly, the stable-diffusion-inpainting model seems to be the only inpainting model that works correctly with the Unified Canvas. I’ve attached the relevant logs to provide further details on this.

[2023-08-02 14:23:43,116]::[uvicorn.access]::INFO --> 127.0.0.1:63040 - "GET /api/v1/images/?is_intermediate=true HTTP/1.1" 200
[2023-08-02 14:26:38,634]::[uvicorn.access]::INFO --> 127.0.0.1:63141 - "POST /api/v1/images/?image_category=general&is_intermediate=true HTTP/1.1" 201
[2023-08-02 14:26:38,680]::[uvicorn.access]::INFO --> 127.0.0.1:63141 - "POST /api/v1/images/?image_category=mask&is_intermediate=true HTTP/1.1" 201
[2023-08-02 14:26:38,694]::[uvicorn.access]::INFO --> 127.0.0.1:63141 - "POST /api/v1/sessions/ HTTP/1.1" 200
[2023-08-02 14:26:38,724]::[uvicorn.access]::INFO --> 127.0.0.1:63141 - "PUT /api/v1/sessions/7c7942ce-9bc5-49fa-83fe-6eeb0f339a1d/invoke?all=true HTTP/1.1" 202
[2023-08-02 14:26:38,734]::[uvicorn.access]::INFO --> 127.0.0.1:63142 - "PATCH /api/v1/images/9bc7d171-15fe-4a74-b6d8-ce84ad4a02b1.png HTTP/1.1" 200
[2023-08-02 14:26:38,736]::[uvicorn.access]::INFO --> 127.0.0.1:63143 - "PATCH /api/v1/images/916884c9-b6c7-4aff-8bfb-27631822035e.png HTTP/1.1" 200
[2023-08-02 14:26:38,741]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/sd-1/main/stable-diffusion-inpainting, type sd-1:main:tokenizer
[2023-08-02 14:26:39,090]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/sd-1/main/stable-diffusion-inpainting, type sd-1:main:text_encoder
[2023-08-02 14:26:51,462]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/sd-1/main/stable-diffusion-inpainting, type sd-1:main:scheduler
[2023-08-02 14:26:51,738]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/sd-1/main/stable-diffusion-inpainting, type sd-1:main:unet
[2023-08-02 14:26:57,638]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/sd-1/main/stable-diffusion-inpainting, type sd-1:main:vae
Generating:   0%|                                                                                                                                                                               | 0/1 [00:00<?, ?it/s]You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.StableDiffusionImg2ImgPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .

 11%|███████████████████▌                                                                                                                                                              | 8/73 [00:07<00:57,  1.13it/s]

Screenshots

No response

Additional context

Logs of failed attempt with other inpainting models.

[2023-08-02 14:22:00,912]::[uvicorn.access]::INFO --> 127.0.0.1:62878 - "POST /api/v1/images/?image_category=general&is_intermediate=true HTTP/1.1" 201
[2023-08-02 14:22:00,952]::[uvicorn.access]::INFO --> 127.0.0.1:62878 - "POST /api/v1/images/?image_category=mask&is_intermediate=true HTTP/1.1" 201
[2023-08-02 14:22:00,965]::[uvicorn.access]::INFO --> 127.0.0.1:62878 - "POST /api/v1/sessions/ HTTP/1.1" 200
[2023-08-02 14:22:01,000]::[uvicorn.access]::INFO --> 127.0.0.1:62878 - "PUT /api/v1/sessions/b33ea185-f7c0-4fa8-9d65-2148bff29a0a/invoke?all=true HTTP/1.1" 202
[2023-08-02 14:22:01,050]::[uvicorn.access]::INFO --> 127.0.0.1:62879 - "PATCH /api/v1/images/f5a5baed-1c1b-42be-b370-a14b872e0ed3.png HTTP/1.1" 200
[2023-08-02 14:22:01,088]::[uvicorn.access]::INFO --> 127.0.0.1:62880 - "PATCH /api/v1/images/5d79a6d3-abd6-4e10-ad68-68e677c6aaab.png HTTP/1.1" 200
[2023-08-02 14:22:02,574]::[InvokeAI]::INFO --> Loading model /Applications/InvokeAI/models/.cache/d35ae597b8af6273326895437bfd6520, type sd-1:main:unet
[2023-08-02 14:22:03,224]::[InvokeAI]::ERROR --> Traceback (most recent call last):
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/app/services/processor.py", line 86, in __process
    outputs = invocation.invoke(
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/app/invocations/generate.py", line 220, in invoke
    with self.load_model_old_way(context, scheduler) as model:
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/app/invocations/generate.py", line 174, in load_model_old_way
    unet_info = context.services.model_manager.get_model(
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/app/services/model_manager_service.py", line 364, in get_model
    model_info = self.mgr.get_model(
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/backend/model_management/model_manager.py", line 491, in get_model
    model_context = self.cache.get_model(
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/backend/model_management/model_cache.py", line 198, in get_model
    model = model_info.get_model(child_type=submodel, torch_dtype=self.precision)
  File "/Applications/InvokeAI/.venv/lib/python3.9/site-packages/invokeai/backend/model_management/models/base.py", line 286, in get_model
    raise Exception(f"Failed to load {self.base_model}:{self.model_type}:{child_type} model")
Exception: Failed to load sd-1:main:unet model

[2023-08-02 14:22:03,226]::[InvokeAI]::ERROR --> Error while invoking:
Failed to load sd-1:main:unet model

Contact Details

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 27 (3 by maintainers)

Most upvoted comments

@dannyvfilms @nbs @nelsonre @BakonGuy @egoegoegoegoego could y’all try re-adding the model that was giving you difficulty and seeing if that fixes the issue?

@Quildar could you try updating to 3.0.2rc1 and see if the issue persists?

Many inpainting checkpoint models are not loading properly in 3.0.1. The fix is in the main branch of the code and will be rolled out in 3.0.2 (very soon now).

I also encountered this problem. After a long investigation, I found out that the problem was caused by changing the version of transformers from 4.31.0 to 4.25.0 and changing the version of timm from 0.6.13 to 0.4.12. After I restored the versions of transformers and timm to the versions required by the invokeai project (that is, versions 4.31.0 and 0.6.13), the problem was solved.