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

All schedulers have broken beta and exponential sigma methods #9951

Open
vladmandic opened this issue Nov 18, 2024 · 2 comments · May be fixed by #9954
Open

All schedulers have broken beta and exponential sigma methods #9951

vladmandic opened this issue Nov 18, 2024 · 2 comments · May be fixed by #9954
Labels
bug Something isn't working

Comments

@vladmandic
Copy link
Contributor

vladmandic commented Nov 18, 2024

Describe the bug

following schedulers implement beta and exponential sigma methods:

scheduling_deis_multistep.py
scheduling_dpmsolver_multistep.py
scheduling_dpmsolver_multistep_inverse.py
scheduling_dpmsolver_sde.py
scheduling_dpmsolver_singlestep.py
scheduling_euler_discrete.py
scheduling_heun_discrete.py
scheduling_k_dpm_2_ancestral_discrete.py
scheduling_k_dpm_2_discrete.py
scheduling_lms_discrete.py
scheduling_sasolver.py
scheduling_unipc_multistep.py

and in all of them, its pretty much broken.
(ok, i admit i tested only 6, not all)

looking at code segment:

        elif self.config.use_exponential_sigmas:
            sigmas = self._convert_to_exponential(in_sigmas=sigmas, num_inference_steps=self.num_inference_steps)
            timesteps = np.array([self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas])
        elif self.config.use_beta_sigmas:
            sigmas = self._convert_to_beta(in_sigmas=sigmas, num_inference_steps=self.num_inference_steps)
            timesteps = np.array([self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas])
  1. it refers to log_sigmas, but they are only set if self.config.use_karras_sigmas, otherwise its UNDEFINED
  2. it refers to self.num_inference_steps, but that param is set AFTER this code segment and here its NONE
  3. actual sigmas at the end are blindly converted from numpy to tensor even if they are already a tensor causing a runtime error

Reproduction

simply use ANY of the above schedulers with either use_exponential_sigmas or use_beta_sigmas

Logs

UnboundLocalError: cannot access local variable 'log_sigmas' where it is not associated with a value

or 

TypeError: linspace() received an invalid combination of arguments - got (float, float, NoneType), but expected one of:

or 

TypeError: 'NoneType' object cannot be interpreted as an integer

or 

TypeError: expected np.ndarray (got Tensor)

System Info

diffusers from main branch as of 11/18/24 commit #345907f

Who can help?

@yiyixuxu @sayakpaul @DN6 @asomoza

@vladmandic vladmandic added the bug Something isn't working label Nov 18, 2024
@sayakpaul
Copy link
Member

Thanks, Vlad. Do you have a version/commit id you that you know to be working?

@vladmandic
Copy link
Contributor Author

imo, i don't think they ever were? exponential was added via pr #9518 and beta via pr #9538
i did briefly mention the problem in the pr itself, but was told to create an issue.

@hlky hlky linked a pull request Nov 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants