The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
ModelSamplingFlux now takes a resolution and adjusts the shift with it.
comfyanonymous56f3c660bf79
diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.pyindex fef8a4873..918e6085a 100644--- a/comfy_extras/nodes_model_advanced.py+++ b/comfy_extras/nodes_model_advanced.py@@ -2,6 +2,7 @@ import folder_pathsimport comfy.sdimport comfy.model_samplingimport comfy.latent_formats+import nodesimport torchclass LCM(comfy.model_sampling.EPS):@@ -174,7 +175,10 @@ class ModelSamplingFlux:@classmethoddef INPUT_TYPES(s):return {"required": { "model": ("MODEL",),- "shift": ("FLOAT", {"default": 1.15, "min": 0.0, "max": 100.0, "step":0.01}),+ "max_shift": ("FLOAT", {"default": 1.15, "min": 0.0, "max": 100.0, "step":0.01}),+ "base_shift": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 100.0, "step":0.01}),+ "width": ("INT", {"default": 1024, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 8}),+ "height": ("INT", {"default": 1024, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 8}),}}RETURN_TYPES = ("MODEL",)@@ -182,9 +186,15 @@ class ModelSamplingFlux:CATEGORY = "advanced/model"- def patch(self, model, shift):+ def patch(self, model, max_shift, base_shift, width, height):m = model.clone()+ x1 = 256+ x2 = 4096+ mm = (max_shift - base_shift) / (x2 - x1)+ b = base_shift - mm * x1+ shift = (width * height / (8 * 8 * 2 * 2)) * mm + b+sampling_base = comfy.model_sampling.ModelSamplingFluxsampling_type = comfy.model_sampling.CONST