Skip to content

Commit

Permalink
change the behavior of discard_next_to_last_sigma for sgm_uniform to …
Browse files Browse the repository at this point in the history
…match other schedulers
  • Loading branch information
AUTOMATIC1111 committed Mar 20, 2024
1 parent ac9aa44 commit 31306ce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions modules/sd_samplers_kdiffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ def get_sigmas(self, p, steps):
if scheduler.need_inner_model:
sigmas_kwargs['inner_model'] = self.model_wrap

if scheduler.name == "sgm_uniform": # XXX check this
# Ensure the "step" will be target step + 1
steps += 1 if not discard_next_to_last_sigma else 0

sigmas = scheduler.function(n=steps, **sigmas_kwargs, device=shared.device)

if discard_next_to_last_sigma:
Expand Down
2 changes: 1 addition & 1 deletion modules/sd_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def sgm_uniform(n, sigma_min, sigma_max, inner_model, device):
end = inner_model.sigma_to_t(torch.tensor(sigma_min))
sigs = [
inner_model.t_to_sigma(ts)
for ts in torch.linspace(start, end, n)[:-1]
for ts in torch.linspace(start, end, n + 1)[:-1]
]
sigs += [0.0]
return torch.FloatTensor(sigs).to(device)
Expand Down

0 comments on commit 31306ce

Please sign in to comment.