Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDXL Turbo support #27

Open
cchance27 opened this issue Nov 29, 2023 · 7 comments
Open

SDXL Turbo support #27

cchance27 opened this issue Nov 29, 2023 · 7 comments

Comments

@cchance27
Copy link
Contributor

cchance27 commented Nov 29, 2023

Will SDXL Turbo support be possible i saw you got SDXL support working, i'm still reading up on Turbo, but the implementation details seem to point towards it being a different scheduler and some form of layer on top of SDXL as i read that you can pull turbo of of the base model and apply it to finetunes.

So does that mean we can technically just use it as a normal SDXL Model in the convertor and just need to use a different sampler to handle turbo noise correctly?

Edit: Seems that Turbo works fine using the standard comfy workflow, just using the Convertor + Adapter into the SamplerCustom, not sure if a SamplerDiscrete needs to be inlined or not, it doesn't seem to me a difference direct/eps/lcm set... but maybe i'm missing something.

@cchance27
Copy link
Contributor Author

Just a tip, don't use SDXL Turbo at 1024x1024 lol it really creates horror images
image

@aszc-dev
Copy link
Owner

aszc-dev commented Dec 3, 2023

Just tried it and it works indeed. Too bad the quality is visibly worse when compared side by side with .safetensors (images are blurry and colors are slightly faded).
Original:
obraz
Converted to Core ML:
obraz

And since we can't use ANE, the speed is the same as with MPS (at least on my machine).
I don't know if this is the support you meant 😄 I'll see if there's any way to improve it, but it will probably require rewriting the SDXL part itself to run on NE, and I don't know yet if it's even possible.

@cchance27
Copy link
Contributor Author

This isn't likely due to SDXL specifically, the fact SDXL doesn't work with ANE< and the fact theirs no turbo model for 1.5 models is really annoying.

@rovo79
Copy link
Contributor

rovo79 commented Dec 4, 2023

@aszc-dev I've been wondering what the source of this degradation or blurriness is...? Is it related to the coremltools model conversion of shapes?

@cchance27
Copy link
Contributor Author

There actually a bug in the ml-stable-diffusion repo there’s an active pr to fix the blurriness with sdxl but hasn’t been accepted looks like a similar issue

@aszc-dev
Copy link
Owner

aszc-dev commented Dec 5, 2023

@rovo79 Sorry, still haven't figured it out. Keep in mind that for the reasons explained in ml-stable-diffusion's FAQ the output is expected to differ slightly. Perhaps there is something in the way the Turbo model works that enhances these differences. I would have to take a closer look to find the cause.

@cchance27 Yes, this looks very similar to the issue described here, if that's what you had in mind. No, this part is handled by Comfy and proper value is being used (double-checked to be sure). But perhaps it's something closely related, maybe there is some oversight in the conversion code, although that's unexpected since base SDXL doesn't have this issue.

@alexqem
Copy link

alexqem commented Apr 16, 2024

I get errors trying to setup on my M3 pro

File "/Users/user/www/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/init.py", line 6, in
from coreml_suite.nodes import (
File "/Users/user/www/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite/coreml_suite/nodes.py", line 3, in
from coremltools import ComputeUnit
ModuleNotFoundError: No module named 'coremltools'

Cannot import /Users/user/www/ComfyUI/custom_nodes/ComfyUI-CoreMLSuite module for custom nodes: No module named 'coremltools'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants