code: def get_sigmas(self, p, steps):
      discard_next_to_last_sigma = (
          self.config is not None
          and self.config.options.get(
              "discard_next_to_last_sigma", False
          )
      )
      if (
          opts.always_discard_next_to_last_sigma
          and not discard_next_to_last_sigma
      ):
          discard_next_to_last_sigma = True
          p.extra_generation_params["Discard penultimate sigma"] = True
  
      steps += 1 if discard_next_to_last_sigma else 0
  
      if p.sampler_noise_scheduler_override:
          sigmas = p.sampler_noise_scheduler_override(steps)
      elif opts.k_sched_type != "Automatic":
          m_sigma_min, m_sigma_max = (
              self.model_wrap.sigmas[0].item(),
              self.model_wrap.sigmas[-1].item(),
          )
          sigma_min, sigma_max = (
              (0.1, 10)
              if opts.use_old_karras_scheduler_sigmas
              else (m_sigma_min, m_sigma_max)
          )
          sigmas_kwargs = {
              "sigma_min": sigma_min,
              "sigma_max": sigma_max,
          }
  
          sigmas_func = k_diffusion_scheduler[opts.k_sched_type]
          p.extra_generation_params["Schedule type"] = opts.k_sched_type
  
          if opts.sigma_min != m_sigma_min and opts.sigma_min != 0:
              sigmas_kwargs["sigma_min"] = opts.sigma_min
              p.extra_generation_params[
                  "Schedule min sigma"
              ] = opts.sigma_min
          if opts.sigma_max != m_sigma_max and opts.sigma_max != 0:
              sigmas_kwargs["sigma_max"] = opts.sigma_max
              p.extra_generation_params[
                  "Schedule max sigma"
              ] = opts.sigma_max
  
          default_rho = (
              1.0 if opts.k_sched_type == "polyexponential" else 7.0
          )
  
          if (
              opts.k_sched_type != "exponential"
              and opts.rho != 0
              and opts.rho != default_rho
          ):
              sigmas_kwargs["rho"] = opts.rho
              p.extra_generation_params["Schedule rho"] = opts.rho
  
          sigmas = sigmas_func(
              n=steps, **sigmas_kwargs, device=shared.device
          )
      elif (
          self.config is not None
          and self.config.options.get("scheduler", None) == "karras"
      ):
          sigma_min, sigma_max = (
              (0.1, 10)
              if opts.use_old_karras_scheduler_sigmas
              else (
                  self.model_wrap.sigmas[0].item(),
                  self.model_wrap.sigmas[-1].item(),
              )
          )
  
          sigmas = k_diffusion.sampling.get_sigmas_karras(
              n=steps,
              sigma_min=sigma_min,
              sigma_max=sigma_max,
              device=shared.device,
          )
      elif (
          self.config is not None
          and self.config.options.get("scheduler", None)
          == "exponential"
      ):
          m_sigma_min, m_sigma_max = (
              self.model_wrap.sigmas[0].item(),
              self.model_wrap.sigmas[-1].item(),
          )
          sigmas = k_diffusion.sampling.get_sigmas_exponential(
              n=steps,
              sigma_min=m_sigma_min,
              sigma_max=m_sigma_max,
              device=shared.device,
          )
      else:
          sigmas = self.model_wrap.get_sigmas(steps)
  
      if discard_next_to_last_sigma:
          sigmas = torch.cat([sigmas[:-2], sigmas[-1:]])
  
      return sigmas
  
file_path: stable-diffusion-webui/modules/sd_samplers_kdiffusion.py
imports: import torch
  import inspect
  import k_diffusion.sampling
  from modules import sd_samplers_common, sd_samplers_extra, sd_samplers_cfg_denoiser
  from modules.sd_samplers_cfg_denoiser import CFGDenoiser
  from modules.script_callbacks import ExtraNoiseParams, extra_noise_callback
  from modules.shared import opts
  import modules.shared
label_desc: Use image node_id 2 for calling the KDiffusionSampler obj's underlying member method code with example usage: obj.get_sigmas(p, steps) and returns: sigmas