Turbo sampler: drop the scheduler (it was sgm_uniform); the sampler stays registered
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tw9fjUCoaPNZ8uLoL2xACR
This commit is contained in:
@@ -173,23 +173,13 @@ def registered(model, x, sigmas, extra_args=None, callback=None, disable=None, *
|
||||
return make(_CURRENT or _settings({}))(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, **options)
|
||||
|
||||
|
||||
def schedule(model_sampling, steps):
|
||||
"""`funui_turbo` in ComfyUI's scheduler list: the evenly spaced timesteps of `sgm_uniform`, the grid the turbo
|
||||
merges are trained on."""
|
||||
import comfy.samplers
|
||||
return comfy.samplers.normal_scheduler(model_sampling, steps, sgm=True)
|
||||
|
||||
|
||||
def register():
|
||||
"""Add the sampler and the scheduler to ComfyUI's own lists (in place: its Sampler nodes share the lists)."""
|
||||
"""Add the sampler to ComfyUI's own list (in place: its Sampler nodes share the list)."""
|
||||
import comfy.k_diffusion.sampling as ksampling
|
||||
import comfy.samplers
|
||||
if "funui_turbo" not in comfy.samplers.SAMPLER_NAMES:
|
||||
ksampling.sample_funui_turbo = registered
|
||||
comfy.samplers.SAMPLER_NAMES.append("funui_turbo")
|
||||
if "funui_turbo" not in comfy.samplers.SCHEDULER_HANDLERS:
|
||||
comfy.samplers.SCHEDULER_HANDLERS["funui_turbo"] = comfy.samplers.SchedulerHandler(schedule)
|
||||
comfy.samplers.SCHEDULER_NAMES.append("funui_turbo")
|
||||
|
||||
|
||||
register()
|
||||
|
||||
@@ -141,17 +141,16 @@ def test_without_two_stages_and_without_polish(model):
|
||||
assert len(calls) == 3 and torch.isfinite(out.unbind()[0]).all()
|
||||
|
||||
|
||||
def test_registered_in_comfys_lists_and_runs_like_the_module(model):
|
||||
def test_registered_in_comfys_sampler_list_and_runs_like_the_module(model):
|
||||
import comfy.samplers
|
||||
from comfy.nested_tensor import NestedTensor
|
||||
assert "funui_turbo" in comfy.samplers.SAMPLER_NAMES and "funui_turbo" in comfy.samplers.SCHEDULER_NAMES
|
||||
assert "funui_turbo" in comfy.samplers.SAMPLER_NAMES
|
||||
patched = model.clone()
|
||||
guider = comfy.samplers.CFGGuider(patched)
|
||||
cond = [[torch.randn(1, 5, 48), {}]]
|
||||
guider.set_conds(cond, cond)
|
||||
guider.set_cfg(1.0)
|
||||
sigmas = comfy.samplers.calculate_sigmas(patched.get_model_object("model_sampling"), "funui_turbo", 4)
|
||||
assert torch.allclose(sigmas, comfy.samplers.calculate_sigmas(patched.get_model_object("model_sampling"), "sgm_uniform", 4))
|
||||
sigmas = comfy.samplers.calculate_sigmas(patched.get_model_object("model_sampling"), "sgm_uniform", 4)
|
||||
noise = NestedTensor((torch.randn(1, 24, 2, 8, 8), torch.randn(1, 32, 2, 3)))
|
||||
latent = NestedTensor((torch.zeros(1, 24, 2, 8, 8), torch.zeros(1, 32, 2, 3)))
|
||||
out = guider.sample(noise, latent, comfy.samplers.sampler_object("funui_turbo"), sigmas, seed=1, disable_pbar=True)
|
||||
|
||||
Reference in New Issue
Block a user