MCPcopy
hub / github.com/Wan-Video/Wan2.2 / FlowDPMSolverMultistepScheduler

Class FlowDPMSolverMultistepScheduler

wan/utils/fm_solvers.py:71–859  ·  view source on GitHub ↗

`FlowDPMSolverMultistepScheduler` is a fast dedicated high-order solver for diffusion ODEs. This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic methods the library implements for all schedulers such as loading and saving.

Source from the content-addressed store, hash-verified

69
70
71class FlowDPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
72 """
73 `FlowDPMSolverMultistepScheduler` is a fast dedicated high-order solver for diffusion ODEs.
74 This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic
75 methods the library implements for all schedulers such as loading and saving.
76 Args:
77 num_train_timesteps (`int`, defaults to 1000):
78 The number of diffusion steps to train the model. This determines the resolution of the diffusion process.
79 solver_order (`int`, defaults to 2):
80 The DPMSolver order which can be `1`, `2`, or `3`. It is recommended to use `solver_order=2` for guided
81 sampling, and `solver_order=3` for unconditional sampling. This affects the number of model outputs stored
82 and used in multistep updates.
83 prediction_type (`str`, defaults to "flow_prediction"):
84 Prediction type of the scheduler function; must be `flow_prediction` for this scheduler, which predicts
85 the flow of the diffusion process.
86 shift (`float`, *optional*, defaults to 1.0):
87 A factor used to adjust the sigmas in the noise schedule. It modifies the step sizes during the sampling
88 process.
89 use_dynamic_shifting (`bool`, defaults to `False`):
90 Whether to apply dynamic shifting to the timesteps based on image resolution. If `True`, the shifting is
91 applied on the fly.
92 thresholding (`bool`, defaults to `False`):
93 Whether to use the "dynamic thresholding" method. This method adjusts the predicted sample to prevent
94 saturation and improve photorealism.
95 dynamic_thresholding_ratio (`float`, defaults to 0.995):
96 The ratio for the dynamic thresholding method. Valid only when `thresholding=True`.
97 sample_max_value (`float`, defaults to 1.0):
98 The threshold value for dynamic thresholding. Valid only when `thresholding=True` and
99 `algorithm_type="dpmsolver++"`.
100 algorithm_type (`str`, defaults to `dpmsolver++`):
101 Algorithm type for the solver; can be `dpmsolver`, `dpmsolver++`, `sde-dpmsolver` or `sde-dpmsolver++`. The
102 `dpmsolver` type implements the algorithms in the [DPMSolver](https://huggingface.co/papers/2206.00927)
103 paper, and the `dpmsolver++` type implements the algorithms in the
104 [DPMSolver++](https://huggingface.co/papers/2211.01095) paper. It is recommended to use `dpmsolver++` or
105 `sde-dpmsolver++` with `solver_order=2` for guided sampling like in Stable Diffusion.
106 solver_type (`str`, defaults to `midpoint`):
107 Solver type for the second-order solver; can be `midpoint` or `heun`. The solver type slightly affects the
108 sample quality, especially for a small number of steps. It is recommended to use `midpoint` solvers.
109 lower_order_final (`bool`, defaults to `True`):
110 Whether to use lower-order solvers in the final steps. Only valid for < 15 inference steps. This can
111 stabilize the sampling of DPMSolver for steps < 15, especially for steps <= 10.
112 euler_at_final (`bool`, defaults to `False`):
113 Whether to use Euler&#x27;s method in the final step. It is a trade-off between numerical stability and detail
114 richness. This can stabilize the sampling of the SDE variant of DPMSolver for small number of inference
115 steps, but sometimes may result in blurring.
116 final_sigmas_type (`str`, *optional*, defaults to "zero"):
117 The final `sigma` value for the noise schedule during the sampling process. If `"sigma_min"`, the final
118 sigma is the same as the last sigma in the training schedule. If `zero`, the final sigma is set to 0.
119 lambda_min_clipped (`float`, defaults to `-inf`):
120 Clipping threshold for the minimum value of `lambda(t)` for numerical stability. This is critical for the
121 cosine (`squaredcos_cap_v2`) noise schedule.
122 variance_type (`str`, *optional*):
123 Set to "learned" or "learned_range" for diffusion models that predict variance. If set, the model&#x27;s output
124 contains the predicted Gaussian variance.
125 """
126
127 _compatibles = [e.name for e in KarrasDiffusionSchedulers]
128 order = 1

Callers 6

generateMethod · 0.85
generateMethod · 0.85
generateMethod · 0.85
t2vMethod · 0.85
i2vMethod · 0.85
generateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected