docstr: Linear Multistep Scheduler for discrete beta schedules. Based on the original k-diffusion implementation by
  Katherine Crowson:
  https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181
docstr_tok: ["Linear","Multistep","Scheduler","for","discrete","beta","schedules",".","Based","on","the","original","k-diffusion","implementation","by","Katherine","Crowson",":","https",":","\/\/github.com\/crowsonkb\/k-diffusion\/blob\/481677d114f6ea445aa009cf5bd7a9cdee909e47\/k_diffusion\/sampling.py","#","L181"]
code: def __init__(
      self,
      num_train_timesteps=1000,
      beta_start=0.0001,
      beta_end=0.02,
      beta_schedule="linear",
      trained_betas=None,
      timestep_values=None,
      tensor_format="pd",
  ):
      """
      Linear Multistep Scheduler for discrete beta schedules. Based on the original k-diffusion implementation by
      Katherine Crowson:
      https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181
      """
  
      if beta_schedule == "linear":
          self.betas = np.linspace(
              beta_start,
              beta_end,
              num_train_timesteps,
              dtype=np.float32,
          )
      elif beta_schedule == "scaled_linear":
          # this schedule is very specific to the latent diffusion model.
          self.betas = (
              np.linspace(
                  beta_start**0.5,
                  beta_end**0.5,
                  num_train_timesteps,
                  dtype=np.float32,
              )
              ** 2
          )
      else:
          raise NotImplementedError(
              f"{beta_schedule} does is not implemented for {self.__class__}"
          )
  
      self.alphas = 1.0 - self.betas
      self.alphas_cumprod = np.cumprod(self.alphas, axis=0)
  
      self.sigmas = (
          (1 - self.alphas_cumprod) / self.alphas_cumprod
      ) ** 0.5
  
      # setable values
      self.num_inference_steps = None
      self.timesteps = np.arange(0, num_train_timesteps)[::-1].copy()
      self.derivatives = []
  
      self.tensor_format = tensor_format
      self.set_format(tensor_format=tensor_format)
  
file_path: PaddleHub/modules/image/text_to_image/stable_diffusion_img2img/diffusers/schedulers/scheduling_lms_discrete.py
imports: from typing import Union
  import numpy
  import paddle
  from scipy import integrate
  from ..configuration_utils import ConfigMixin
  from ..configuration_utils import register_to_config
  from .scheduling_utils import SchedulerMixin
label_desc: Use image node_id 1 to create a new LMSDiscreteScheduler object from inherited base classes: SchedulerMixin, ConfigMixin with example: obj = LMSDiscreteScheduler(num_train_timesteps, beta_start, beta_end, beta_schedule, trained_betas, timestep_values, tensor_format)