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

[Bug]: Apple silicon can't use dpm++ 2m sampling model #4558

Closed
1 task done
sung-ho-moon opened this issue Nov 10, 2022 · 7 comments
Closed
1 task done

[Bug]: Apple silicon can't use dpm++ 2m sampling model #4558

sung-ho-moon opened this issue Nov 10, 2022 · 7 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@sung-ho-moon
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

when I use SD,
I can't use dpm++ 2m, dpm++ 2m karras sampler
All results is black screen.

Steps to reproduce the problem

when I use dpm++2m, dpm++2m karras
results is black picture

I'm using SD, Apple silicon M1

I editted K-diffusion/k-diffusion/sampling.py

//
def to_d(x, sigma, denoised):
"""Converts a denoiser output to a Karras ODE derivative."""
sigma = sigma.to('cpu').to('mps')
return (x - denoised) / utils.append_dims(sigma, x.ndim)
//

Is anyone using dpm++ 2m Apple silicon?

What should have happened?

get the picture

Commit where the problem happens

ac08562

What platforms do you use to access UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

No response

Additional information, context and logs

No response

@sung-ho-moon sung-ho-moon added the bug-report Report of a bug, yet to be confirmed label Nov 10, 2022
@remixer-dec
Copy link
Contributor

remixer-dec commented Nov 10, 2022

Same bug here.
Looks like the problem is that this function returns the same value for different inputs, this is really weird, because exactly the same function declared a few lines above it, behaves correctly.

anyways, here is a fix:

t_fn = lambda sigma: sigma.to('cpu').log().neg().to('mps')

Update: this bug only appears when list indices are used and is fixed in the latest pytorch nightly (but there are some known problems currently in the nightly builds, so I do not recommend upgrading)

@sung-ho-moon
Copy link
Author

@remixer-dec thank you, problem solved

@remixer-dec
Copy link
Contributor

@moon-haha
I think this fix should be also applied to DPM++ 2S a, it is currently working only because of noise, here is an example

@sung-ho-moon
Copy link
Author

@remixer-dec
that's right, DPM++ 2S a Has Noise Bug too, again Thank you

brycedrennan added a commit to brycedrennan/imaginAIry that referenced this issue Nov 13, 2022
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
brycedrennan added a commit to brycedrennan/imaginAIry that referenced this issue Nov 13, 2022
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
brycedrennan added a commit to brycedrennan/imaginAIry that referenced this issue Nov 13, 2022
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
brycedrennan added a commit to brycedrennan/imaginAIry that referenced this issue Nov 13, 2022
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
brycedrennan added a commit to brycedrennan/imaginAIry that referenced this issue Nov 13, 2022
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
@lsooxlla8
Copy link

lsooxlla8 commented Nov 18, 2022

anyways, here is a fix:

t_fn = lambda sigma: sigma.to('cpu').log().neg().to('mps')

Could you please explain where to paste it to, for noncoders?

@remixer-dec
Copy link
Contributor

remixer-dec commented Nov 18, 2022

@lsooxlla8 repositories/k-diffusion/sampling.py replace this line and this line and make sure the indentation is the same

mattstern31 added a commit to mattstern31/imagin-AIry-Python that referenced this issue Nov 11, 2023
As documented here: AUTOMATIC1111/stable-diffusion-webui#4558 (comment)

- make image logs more consistent
- note which step the progress images belong to in the filename
@modusCell
Copy link

@remixer-dec

    # t_fn = lambda sigma: sigma.log().neg()
    t_fn = lambda sigma: sigma.to('cpu').log().neg().to('mps')

Commented out that line and inserted the one you suggested, restarted ComfyUI and everything. it's still the same.
Let's say there are 8 steps, first 6 steps I can see image / noise, after finishing step 6 image turn to black.

This applies to SD, XL and Turbo for all DMP++

cli command for starting ComfyUI:

./venv/bin/python3 main.py --force-fp16 --dont-upcast-attention --disable-xformers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

4 participants