Skip to content

Commit

Permalink
Add a ModelSamplingAuraFlow node to change the shift value.
Browse files Browse the repository at this point in the history
Set the default AuraFlow shift value to 1.73 (sqrt(3)).
  • Loading branch information
comfyanonymous committed Jul 11, 2024
1 parent 9f291d7 commit 8e01204
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions comfy/supported_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ class AuraFlow(supported_models_base.BASE):

sampling_settings = {
"multiplier": 1.0,
"shift": 1.73,
}

unet_extra_config = {}
Expand Down
17 changes: 15 additions & 2 deletions comfy_extras/nodes_model_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def INPUT_TYPES(s):

CATEGORY = "advanced/model"

def patch(self, model, shift):
def patch(self, model, shift, multiplier=1000):
m = model.clone()

sampling_base = comfy.model_sampling.ModelSamplingDiscreteFlow
Expand All @@ -154,10 +154,22 @@ class ModelSamplingAdvanced(sampling_base, sampling_type):
pass

model_sampling = ModelSamplingAdvanced(model.model.model_config)
model_sampling.set_parameters(shift=shift)
model_sampling.set_parameters(shift=shift, multiplier=multiplier)
m.add_object_patch("model_sampling", model_sampling)
return (m, )

class ModelSamplingAuraFlow(ModelSamplingSD3):
@classmethod
def INPUT_TYPES(s):
return {"required": { "model": ("MODEL",),
"shift": ("FLOAT", {"default": 1.73, "min": 0.0, "max": 100.0, "step":0.01}),
}}

FUNCTION = "patch_aura"

def patch_aura(self, model, shift):
return self.patch(model, shift, multiplier=1.0)

class ModelSamplingContinuousEDM:
@classmethod
def INPUT_TYPES(s):
Expand Down Expand Up @@ -271,5 +283,6 @@ def rescale_cfg(args):
"ModelSamplingContinuousV": ModelSamplingContinuousV,
"ModelSamplingStableCascade": ModelSamplingStableCascade,
"ModelSamplingSD3": ModelSamplingSD3,
"ModelSamplingAuraFlow": ModelSamplingAuraFlow,
"RescaleCFG": RescaleCFG,
}

0 comments on commit 8e01204

Please sign in to comment.