Guest User

Untitled

a guest
Jun 8th, 2023
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. for i in trange(len(sigmas) - 1, disable=disable):
  2. denoised = model(x, sigmas[i] * s_in, **extra_args)
  3. if callback is not None:
  4. callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised})
  5. t, t_next = t_fn(sigmas[i]), t_fn(sigmas[i + 1])
  6. h = t_next - t
  7.  
  8. t_min = min(sigma_fn(t_next), sigma_fn(t))
  9. t_max = max(sigma_fn(t_next), sigma_fn(t))
  10.  
  11. if old_denoised is None or sigmas[i + 1] == 0:
  12. x = (t_min / t_max) * x - (-h).expm1() * denoised
  13. else:
  14. h_last = t - t_fn(sigmas[i - 1])
  15.  
  16. h_min = min(h_last, h)
  17. h_max = max(h_last, h)
  18. r = h_max / h_min
  19.  
  20. h_d = (h_max + h_min) / 2
  21. denoised_d = (1 + 1 / (2 * r)) * denoised - (1 / (2 * r)) * old_denoised
  22. x = (t_min / t_max) * x - (-h_d).expm1() * denoised_d
  23.  
  24. old_denoised = denoised
Advertisement
Add Comment
Please, Sign In to add comment