MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / FlowDPMSolverMultistepScheduler

Class FlowDPMSolverMultistepScheduler

wan/utils/fm_solvers.py:69–857  ·  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

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected