Files
Miku Chan d2844ce485 Pluggable base sampler + cosine-taper DCT seam + perf opts
Replaces the hand-rolled euler step with segment-based dispatch to
comfy.k_diffusion.sampling.sample_<name> so any sampler comfy ships works
through the SPEED node (euler, dpmpp_2m, er_sde, res_multistep,
dpmpp_3m_sde, uni_pc, ipndm, ...). Multistep solver state resets to
first-order at each spectral-expand boundary -- state across a resolution
change is invalid anyway.

Adds a cosine-taper window (configurable bin width, 0 = original hard
truncation) that crossfades preserved low-frequency coefficients with
freshly-injected noise at the DCT seam, reducing visible ringing at
transitions.

Perf opts:
- module-level DCT-matrix cache keyed on (n, device, dtype)
- dct2_partial computes only the kept top-left block in initial_downscale
  instead of full-DCT-then-slice

Adds tests/test_math.py (10 tests): DCT round-trip, taper edge cases,
variance preservation across expansion configs, initial-downscale
equivalence. Pure tensor math -- no Comfy install required.

Wall time at fixed step count is dominated by the model forward call,
not solver math -- samplers ran within ~1% of each other in measurement.
Step-count reduction is independent of this PR but is now a usable knob
for any sampler.
2026-05-20 22:21:42 +03:00

0 lines
0 B
Python