Spaces:
Running on Zero
Running on Zero
Update pk_workflow.py
Browse files- pk_workflow.py +12 -2
pk_workflow.py
CHANGED
|
@@ -371,8 +371,13 @@ def _dpmpp_2m_sde_step(scheduler, model_output, timestep, sample, eta: float = 1
|
|
| 371 |
# `cpu=True` runs the Brownian-bridge recursion on CPU rather than the GPU — negligible cost next to
|
| 372 |
# the transformer forward pass, but noticeably more numerically stable than `cpu=False`, which is what
|
| 373 |
# ComfyUI's own non-`_gpu`-suffixed variants default to for exactly this reason.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
scheduler._dpmpp_sde_noise_sampler = _BrownianTreeNoiseSampler(
|
| 375 |
-
x,
|
| 376 |
)
|
| 377 |
|
| 378 |
def half_log_snr(s):
|
|
@@ -443,8 +448,13 @@ def _dpmpp_3m_sde_step(scheduler, model_output, timestep, sample, eta: float = 1
|
|
| 443 |
# `cpu=True` runs the Brownian-bridge recursion on CPU rather than the GPU — negligible cost next to
|
| 444 |
# the transformer forward pass, but noticeably more numerically stable than `cpu=False`, which is what
|
| 445 |
# ComfyUI's own non-`_gpu`-suffixed variants default to for exactly this reason.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
scheduler._dpmpp_sde_noise_sampler = _BrownianTreeNoiseSampler(
|
| 447 |
-
x,
|
| 448 |
)
|
| 449 |
|
| 450 |
def half_log_snr(s):
|
|
|
|
| 371 |
# `cpu=True` runs the Brownian-bridge recursion on CPU rather than the GPU — negligible cost next to
|
| 372 |
# the transformer forward pass, but noticeably more numerically stable than `cpu=False`, which is what
|
| 373 |
# ComfyUI's own non-`_gpu`-suffixed variants default to for exactly this reason.
|
| 374 |
+
# Padded a hair beyond the real [min, max] span, not built exactly at it: querying a BrownianTree
|
| 375 |
+
# exactly on its own construction bound is a known torchsde precision edge (`tb<=t1`-style warnings).
|
| 376 |
+
# The pad only widens the tree's internal span — every query below still uses the real, un-padded sigma.
|
| 377 |
+
sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max()
|
| 378 |
+
pad = (sigma_max - sigma_min).clamp_min(1e-6) * 1e-4
|
| 379 |
scheduler._dpmpp_sde_noise_sampler = _BrownianTreeNoiseSampler(
|
| 380 |
+
x, sigma_min - pad, sigma_max + pad, seed=scheduler._dpmpp_sde_seed, cpu=True
|
| 381 |
)
|
| 382 |
|
| 383 |
def half_log_snr(s):
|
|
|
|
| 448 |
# `cpu=True` runs the Brownian-bridge recursion on CPU rather than the GPU — negligible cost next to
|
| 449 |
# the transformer forward pass, but noticeably more numerically stable than `cpu=False`, which is what
|
| 450 |
# ComfyUI's own non-`_gpu`-suffixed variants default to for exactly this reason.
|
| 451 |
+
# Padded a hair beyond the real [min, max] span, not built exactly at it: querying a BrownianTree
|
| 452 |
+
# exactly on its own construction bound is a known torchsde precision edge (`tb<=t1`-style warnings).
|
| 453 |
+
# The pad only widens the tree's internal span — every query below still uses the real, un-padded sigma.
|
| 454 |
+
sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max()
|
| 455 |
+
pad = (sigma_max - sigma_min).clamp_min(1e-6) * 1e-4
|
| 456 |
scheduler._dpmpp_sde_noise_sampler = _BrownianTreeNoiseSampler(
|
| 457 |
+
x, sigma_min - pad, sigma_max + pad, seed=scheduler._dpmpp_sde_seed, cpu=True
|
| 458 |
)
|
| 459 |
|
| 460 |
def half_log_snr(s):
|