Legacy2_SamplerOptions_TimestepScaling
Rewriting the sigma-to-timestep math for Runge-Kutta samplers
- sampler
- sampler
This is a deep-end node, and it's honest about it - the pack's own description reads: "Patches ClownSampler's t_fn and sigma_fn (sigma <-> timestep) formulas to allow picking Runge-Kutta Ci values (midpoints) with different scaling." If that sentence doesn't immediately mean anything to you, that's fine - this node exists for the small slice of RES4LYF users tuning the pack's higher-order implicit and diagonally-implicit samplers (the gauss-legendre, radau, lobatto, kraaijevanger_spijker family) rather than for everyday sampling.
What it's actually adjusting
Every sampler needs to convert between "sigma" (the noise level at a given point in the schedule) and "timestep" (where you are in the sampling process), and vice versa - that's what sigma_fn and t_fn do. For the substep-heavy Runge-Kutta samplers RES4LYF ships (the _2s/_3s/_5s explicit ones, and the fully/diagonally implicit families), the midpoints used for those substeps - the Ci values - depend on how that sigma/timestep conversion is scaled. Changing the formula changes where those midpoints land, which changes how the substeps sample the trajectory between two steps. This is squarely research/tuning territory: RES4LYF's README calls a lot of this area of the pack "experimental and subject to further changes," and this node is a good example of exactly that kind of knob.
The inputs and outputs that matter
sampler(SAMPLER, required) - the sampler you're patching. This matters most for Runge-Kutta-based samplers where Ci scaling is actually consumed; on samplers that don't use midpoint substeps at all, changing these formulas won't have anything to act on.t_fn_formula(STRING, default1/((sigma).exp()+1)) - the sigma-to-timestep formula, as a text expression you can edit directly.sigma_fn_formula(STRING, default((1-t)/t).log()) - the inverse, timestep-to-sigma formula.
Output: a sampler, patched with your formulas, ready to feed into a SamplerCustom-style node same as any other sampler.
How to install it
Ships with RES4LYF - no separate install. Via ComfyUI Manager: search "RES4LYF", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt
Like SamplerOptions_GarbageCollection, this is one of the pack's "Legacy2_" prefixed nodes - predates the ClownsharKSampler all-in-one node, still functional, not the primary workflow for most people.
Common issues & troubleshooting
You edited the formulas and nothing looks different. Confirm you're actually using a sampler where these matter - a plain single-stage Euler step has no midpoint to reschedule, so this node's formulas have nothing to bite on. Switch to one of the _2s/_3s or implicit samplers to see the effect.
A malformed formula errors out or produces NaN/garbage output. These are raw expressions parsed and evaluated against sigma/t, not validated dropdown choices - a typo or a numerically unstable formula (dividing by something that hits zero, for instance) will break sampling rather than warning you gracefully. Revert to the defaults and change one term at a time if you're experimenting.
You're not sure this is the right node for what you're trying to do. If you just want "better quality, higher-order sampling" without touching the underlying math, you probably don't need this - pick one of RES4LYF's res_2m/res_2s/implicit samplers directly in ClownsharKSampler and leave the Ci-scaling formulas at default. This node is specifically for people who already know they want to change how the midpoints are placed, not a general quality knob.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| sampler | SAMPLER | — | |
| t_fn_formula | STRING | 1/((sigma).exp()+1) | — |
| sigma_fn_formula | STRING | ((1-t)/t).log() | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| sampler | SAMPLER | — |