mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-03 21:20:49 +08:00
Allow sampler nodes' internal iteration variables (e.g. step_index)
to flow back upstream through ComfyMathExpression nodes to control
per-step parameters (cfg, s_noise, eta, r) without triggering a
dependency cycle error.
Architecture: Two-level cycle handling
- Static validation: _is_bounded_feedback_cycle() allows cycles
where any node declares BOUNDED_FEEDBACK
- Graph building: _is_feedback_output() skips strong links for
declared feedback sockets, records them in feedback_links
Multi-hop chain walking via _build_feedback_fns() resolves
expression->CFGGuider/Sampler chains with simple_eval + MATH_FUNCTIONS,
composing per-step fn(step, total_steps) callables.
Sampler functions now re-read s_noise/eta/r each iteration via
_init_dynamic_options() / _refresh_dynamic_params() / _apply_dynamic_s_noise().
KSAMPLER.sample() conditionally injects mutable extra_options ref.
Safety: _dynamic_sampler_options popped at function top before model() calls.
One-line opt-in: BOUNDED_FEEDBACK = {'step_index'} on any node.
|
||
|---|---|---|
| .. | ||
| asset_enrichment.py | ||
| cache_provider.py | ||
| caching.py | ||
| graph_utils.py | ||
| graph.py | ||
| jobs.py | ||
| progress.py | ||
| utils.py | ||
| validation.py | ||