

With these, it took 18s to generate one image with the Core ML version of Stable Diffusion v1.4 🤯. all compute units (see next section for details).This corresponds to the -chunk-unet conversion option.Īt the time of this writing, we got best results on my MacBook Pro (M1 Max, 32 GPU cores, 64 GB) using the following combination: The compiled models in the Hub split the large UNet model weights in several files for compatibility with iOS and iPadOS devices. The former is suitable for Python inference, while the compiled version is required for Swift code.

Nevertheless, original can be faster than split_einsum on some devices, so do check it out! original, on the other hand, is only compatible with CPU and GPU. split_einsum was previously introduced by Apple, and is compatible with all the compute units (CPU, GPU and Apple's Neural Engine). These are two alternative implementations of the critical attention blocks. "Original" attention vs "split_einsum".We recommend you try them out and stick with the one that works best in your system. There are several variants of each model that may yield different performance depending on the hardware you use. It's also possible for Core ML to run different portions of the model in different devices to maximize performance. Stable Diffusion v2.1 base: converted originalĬore ML supports all the compute units available in your device: CPU, GPU and Apple's Neural Engine (NE).Stable Diffusion v2 base: converted original.Stable Diffusion v1.5: converted original.Stable Diffusion v1.4: converted original.The official Stable Diffusion checkpoints are already converted and ready for use: The rest of this post guides you on how to use the converted weights in your own code or convert additional weights yourself. We released an app in the Mac App Store as well as the source code to allow other projects to use it. Update: some weeks after this post was written we created a native Swift app that you can use to run Stable Diffusion effortlessly on your own hardware. This Apple repo provides conversion scripts and inference code based on 🧨 Diffusers, and we love it! To make it as easy as possible for you, we converted the weights ourselves and put the Core ML versions of the models in the Hugging Face Hub. Thanks to Apple engineers, you can now run Stable Diffusion on Apple Silicon using Core ML!
