Skip to content

Commit

Permalink
ModelSamplingDiscrete: x0 model support that predict a denoised image.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous authored and xingren23 committed Mar 8, 2024
1 parent 7cbc2d4 commit 981aaf4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion comfy_extras/nodes_model_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def calculate_denoised(self, sigma, model_output, model_input):

return c_out * x0 + c_skip * model_input

class X0(comfy.model_sampling.EPS):
def calculate_denoised(self, sigma, model_output, model_input):
return model_output

class ModelSamplingDiscreteDistilled(comfy.model_sampling.ModelSamplingDiscrete):
original_timesteps = 50

Expand Down Expand Up @@ -68,7 +72,7 @@ class ModelSamplingDiscrete:
@classmethod
def INPUT_TYPES(s):
return {"required": { "model": ("MODEL",),
"sampling": (["eps", "v_prediction", "lcm"],),
"sampling": (["eps", "v_prediction", "lcm", "x0"],),
"zsnr": ("BOOLEAN", {"default": False}),
}}

Expand All @@ -88,6 +92,8 @@ def patch(self, model, sampling, zsnr):
elif sampling == "lcm":
sampling_type = LCM
sampling_base = ModelSamplingDiscreteDistilled
elif sampling == "x0":
sampling_type = X0

class ModelSamplingAdvanced(sampling_base, sampling_type):
pass
Expand Down

0 comments on commit 981aaf4

Please sign in to comment.