madebyollin / maple-diffusion

Stable Diffusion inference on iOS / macOS using MPSGraph
https://madebyoll.in/posts/maple_diffusion/
MIT License
799 stars 51 forks source link

Fatal error: Unexpectedly found nil while unwrapping an Optional value #22

Open alelordelo opened 2 years ago

alelordelo commented 2 years ago

Thanks for sharing this, absolutely amazing!

Tried running on: MacBook Air M1 16GB MacOS Ventura 13.0 (22A380) Xcode 14.0.1 (14A400)

And got this error: maple_diffusion/MapleDiffusion.swift:18: Fatal error: Unexpectedly found nil while unwrapping an Optional value 2022-10-31 16:33:10.431161+0100 maple-diffusion[91931:1445876] maple_diffusion/MapleDiffusion.swift:18: Fatal error: Unexpectedly found nil while unwrapping an Optional value (lldb)

Screenshot 2022-10-31 at 16 38 28

Seems like the files where generated on the bin folder:

Screenshot 2022-10-31 at 16 34 14

Any idea what could be wrong?

Cheers from Stockholm!

alelordelo commented 2 years ago

Additional info...

The .ckpt file is a model created with StableDiffusion DreamBooth. Would this be different than StableDiffusion?

alelordelo commented 2 years ago

Update...

Doing this hack, fixed my issue: https://github.com/madebyollin/maple-diffusion/issues/18

Probably because it added the model files missed... But could this extra files somehow Messe my model inference?

madebyollin commented 2 years ago

I just pushed the missing file (alphas_cumprod.bin) directly to the repo, and I think Dreambooth models should load without crashing now. AFAIK all Stable Diffusion-derived models use the same alphas_cumprod, so it should be safe to include for everyone.

I tested converting moDi-v1-pruned.ckpt and it seems to load now.

image