code: def __init__(
      self,
      model: IDiffusion,
      *,
      schedule: str = "discrete",
      unconditional_cond: Optional[Any] = None,
      unconditional_guidance_scale: float = 1.0,
      t0: Optional[float] = None,
      tT: Optional[float] = None,
      order: int = 2,
      skip_type: str = "time_uniform",
      default_steps: int = 25,
      continuous_beta_0: float = 0.1,
      continuous_beta_1: float = 20.0,
      predict_x0: bool = True,
      thresholding: bool = False,
      threshold_max_val: float = 1.0,
  ):
      if model.parameterization != "eps":
          raise ValueError(
              "only `eps` parameterization is supported in `DPMSolver`"
          )
      super().__init__(model)
      if schedule not in ["discrete", "linear", "cosine"]:
          msg = "only (`discrete` | `linear` | `cosine`) can be used as `schedule`"
          raise ValueError(msg)
      # schedule
      if schedule == "discrete":
          default_tT = 1.0
          log_alphas = 0.5 * torch.log(model.alphas_cumprod)
          self.total_N = len(log_alphas)
          self.t_array = torch.linspace(0.0, 1.0, len(log_alphas) + 1)[
              1:
          ].view(1, -1)
          self.log_alpha_array = log_alphas.view(1, -1)
      else:
          default_tT = 0.9946 if schedule == "cosine" else 1.0
          self.total_N = 1000
          self.beta_0 = continuous_beta_0
          self.beta_1 = continuous_beta_1
          self.cosine_s = 0.008
          self.cosine_beta_max = 999.0
          self.cosine_t_max = (
              math.atan(
                  self.cosine_beta_max * (1.0 + self.cosine_s) / math.pi
              )
              * 2.0
              * (1.0 + self.cosine_s)
              / math.pi
              - self.cosine_s
          )
          self.cosine_log_alpha_0 = math.log(
              math.cos(
                  self.cosine_s / (1.0 + self.cosine_s) * math.pi / 2.0
              )
          )
      # properties
      self.schedule = schedule
      self.unconditional_cond = unconditional_cond
      self.unconditional_guidance_scale = unconditional_guidance_scale
      self.t0 = 1.0 / self.total_N if t0 is None else t0
      self.tT = default_tT if tT is None else tT
      self.order = order
      self.skip_type = skip_type
      self.default_steps = default_steps
      self.predict_x0 = predict_x0
      self.thresholding = thresholding
      self.threshold_max_val = threshold_max_val
  
imports: import math
  import torch
  from torch import Tensor
  from typing import Any
  from typing import Dict
  from typing import List
  from typing import Optional
  from .ddim import DDIMQSampler
  from .basic import merge_ref
  from .utils import append_dims
  from .utils import interpolate_fn
  from .schema import ISampler
  from .schema import IQSampler
  from .schema import IDiffusion
  from .schema import UncondSamplerMixin
  from ..utils import cond_type
  from .....misc.toolkit import get_device
label_desc: Use image node_id 1 to create a new DPMSolver object from inherited base classes: ISampler, UncondSamplerMixin with example: obj = DPMSolver(model)