apple / ml-stable-diffusion

Stable Diffusion with Core ML on Apple Silicon
MIT License
16.79k stars 936 forks source link

CoreML sdxl-v1-base-palettized fails on deployment to iPhone with error E5RT: MILCompileForANE error: failed to compile ANE model using ANEF. Error=_ANECompiler : ANECCompile() FAILED (11) #255

Open davidw0311 opened 1 year ago

davidw0311 commented 1 year ago

I am trying to deploy a core ml model to my iPhone 13 Pro Max (iOS 17 beta)

Using the checkpoints from https://huggingface.co/apple/coreml-stable-diffusion-mixed-bit-palettization/tree/main/coreml-stable-diffusion-xl-base_mbp_4_50_palettized.

My swift initialization of the model is as follows: image

The model loading runs for around 9 mins before crashing with the error: Untitled

Doing monitoring with xcode, it appears that memory spikes right before the crash and the text_encoder_2 is not finished loading: image

Appreciate any suggestions on how to deply the sd-xl model successfully on iPhone.

atiorh commented 1 year ago

This is related to #242 as cpuAndNeuralEngine is meant to be used with a SPLIT_EINSUM (or SPLIT_EINSUM_V2) model whereas the model you linked to is an ORIGINAL model which is meant for cpuAndGPU. We will share some instructions on this soon.