Add example use case in the README.md
Thanks for the work on the model.
On both this repo and the coreml-stable-diffusion-xl-base
there are wrong / no instructions for how to load and use the model with diffusers
.
In fact, the coreml-stable-difusion-xl-base
README currently says to use cuda
, which certainly won't work.
Any chance we can add an example Python script that works for either / both?
Ah, for those who are looking for an example using diffusers
, you can just look here:
https://github.com/apple/ml-stable-diffusion
In there, there's a Python library that uses diffusers
. It's not very straightforward, but you'll need to install that library using a:
$ pip install git+https://github.com/apple/ml-stable-diffusion
From there you'll be able to do a :
from python_coreml_stable_diffusion.pipeline import get_coreml_pipe
If you look at the source code for the pipeline.py
file, you'll see the process for loading and running SD on one of the models:
Once I get it up and running I'll write a blog post.
Hmm after trying this with the models I'm not sure it actually works.
Despite the models being compiled, when I run for the first time, the compilation happens all over again. In the case of UNet, it ended up taking 10s of minutes. (I unzipped the compiled .mlmodelc
files in my directory.)
Once I got the models compiled, when Stable Diffusion begins the pipeline, I get a "Error computing NN outputs.". It seems it's happening when the text_encoder is running.