Skip to content

All schedulers have broken beta and exponential sigma methods #9951

Closed
@vladmandic

Description

@vladmandic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions