The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Save v pred zsnr metadata (#7840)
Pam30159a7fe6bf
diff --git a/comfy/model_sampling.py b/comfy/model_sampling.pyindex b79af1e92..7e7291476 100644--- a/comfy/model_sampling.py+++ b/comfy/model_sampling.py@@ -111,13 +111,14 @@ class ModelSamplingDiscrete(torch.nn.Module):self.num_timesteps = int(timesteps)self.linear_start = linear_startself.linear_end = linear_end+ self.zsnr = zsnr# self.register_buffer('betas', torch.tensor(betas, dtype=torch.float32))# self.register_buffer('alphas_cumprod', torch.tensor(alphas_cumprod, dtype=torch.float32))# self.register_buffer('alphas_cumprod_prev', torch.tensor(alphas_cumprod_prev, dtype=torch.float32))sigmas = ((1 - alphas_cumprod) / alphas_cumprod) ** 0.5- if zsnr:+ if self.zsnr:sigmas = rescale_zero_terminal_snr_sigmas(sigmas)self.set_sigmas(sigmas)diff --git a/comfy_extras/nodes_model_merging.py b/comfy_extras/nodes_model_merging.pyindex ccf601158..78d284889 100644--- a/comfy_extras/nodes_model_merging.py+++ b/comfy_extras/nodes_model_merging.py@@ -209,6 +209,9 @@ def save_checkpoint(model, clip=None, vae=None, clip_vision=None, filename_prefimetadata["modelspec.predict_key"] = "epsilon"elif model.model.model_type == comfy.model_base.ModelType.V_PREDICTION:metadata["modelspec.predict_key"] = "v"+ extra_keys["v_pred"] = torch.tensor([])+ if getattr(model_sampling, "zsnr", False):+ extra_keys["ztsnr"] = torch.tensor([])if not args.disable_metadata:metadata["prompt"] = prompt_info