mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
feat(samplers): apply sigma transforms to ER-SDE flow sigmas
In flow mode ER-SDE only ran karras/beta/exponential on the VP path and silently dropped them, unlike FlowMatchEuler and DPM FlowMatch which redistribute the shifted flow sigmas. Apply the same transform to the flow sigmas in _setup_flow so the sigma method works in flow mode and the ER-SDE FlowMatch variants gain karras/beta/exponential. Default flow schedule is unchanged.
This commit is contained in:
@@ -219,6 +219,17 @@ class ERSDEScheduler(SchedulerMixin, ConfigMixin):
|
||||
sigmas = self._time_shift(mu, 1.0, sigmas)
|
||||
else:
|
||||
sigmas = self.config.shift * sigmas / (1 + (self.config.shift - 1) * sigmas)
|
||||
# redistribute the shifted flow sigmas via the configured schedule (parity with FlowMatchEuler)
|
||||
if self.config.use_karras_sigmas or self.config.use_exponential_sigmas or self.config.use_beta_sigmas:
|
||||
arr = sigmas.detach().cpu().numpy()
|
||||
n = len(arr)
|
||||
if self.config.use_karras_sigmas:
|
||||
arr = self._convert_to_karras(arr, n)
|
||||
elif self.config.use_exponential_sigmas:
|
||||
arr = self._convert_to_exponential(arr, n)
|
||||
elif self.config.use_beta_sigmas:
|
||||
arr = self._convert_to_beta(arr, n)
|
||||
sigmas = torch.from_numpy(np.asarray(arr, dtype=np.float64)).to(device=sigmas.device, dtype=sigmas.dtype)
|
||||
flow_sigmas = sigmas.clamp(min=1e-8, max=1.0 - 1e-8)
|
||||
flow_alphas = torch.ones_like(flow_sigmas)
|
||||
flow_lambdas = flow_sigmas.clone()
|
||||
|
||||
Reference in New Issue
Block a user