-
Notifications
You must be signed in to change notification settings - Fork 15
M1 performance #14
Comments
Potentially related to huggingface/accelerate#796. I'll patch |
thanks! should i reclone and try ? |
Yes, please pull a40d4f9 and run hf2pyke with
|
cool model converted! how long does an image usually take to generate? i've had it loading for about 5 minutes, is that normal? |
I'm not sure about the performance on M1. float32 generation on CPU takes around 3 minutes on my Ryzen 5600X and up to, like, 10 minutes on a Xeon E5-2680 v3. ONNX Runtime is not as well optimized for ARM as x86. If you're looking for the fastest performance on M1 I'd recommend you use HuggingFace Diffusers. HuggingFace has been working hard on MPS support and it's probably your best bet. ONNX Runtime's CoreML backend won't do much for Stable Diffusion, and there's not much else I can do besides writing a custom AI runtime (which tbf I am considering given how many issues ORT has given me...) |
Just got to know this project, also interested on running on M1, I'm curious to know if the maybe the rust backend could provide an added performance, also this implementation looks more flexible than current one provided by Apple. What are the next steps to start the rust backend? Does the requirements.txt need to be adapted to run optimized on M1? I got the model converted as well.
|
I'd be happy to introduce optimizations for M1, however not much of the computation is actually done in Rust, most of it is done by ONNX Runtime. Any optimizations I could do would only shave off maybe a few seconds. I would be open to replacing ONNX Runtime though...
I'm not sure what you mean by this. |
I added support for the CoreML execution provider in 23a7800. I don't have a Mac so I couldn't do any testing, but from a quick glance it looks like the UNet is mostly comprised of supported operators. Execution should be significantly faster, hopefully under a minute. To use the CoreML backend, you need to:
If you experience any issues please let me know. |
Converting the sd-1.5 model from hugging face with the script on m1 mac (
running python3 scripts/hf2pyke.py runwayml/stable-diffusion-v1-5 ~/pyke-diffusers-sd15/
) and getting this traceback:The text was updated successfully, but these errors were encountered: