Reverse T2IAdapter weights to account for ComfyUI changes (means SDXL T2IAdapter softweights have breaking changes due to extra middle weight)

This commit is contained in:
Jedrzej Kosinski
2024-06-27 13:51:18 -05:00
parent bc528228c7
commit 4646bb3a2b
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -116,6 +116,7 @@ class T2IAdapterAdvanced(T2IAdapter, AdvancedControlBase):
raw_weights = [(self.weights.base_multiplier ** float(7 - i)) for i in range(8)]
raw_weights = [raw_weights[-8], raw_weights[-3], raw_weights[-2], raw_weights[-1]]
raw_weights = get_properly_arranged_t2i_weights(raw_weights)
raw_weights.reverse() # need to reverse to match recent ComfyUI changes
return self.weights.copy_with_new_weights(raw_weights)
def get_calc_pow(self, idx: int, layers: int) -> int:
+2
View File
@@ -198,6 +198,7 @@ class SoftT2IAdapterWeights:
uncond_multiplier: float=1.0, cn_extras: dict[str]={}):
weights = [weight_00, weight_01, weight_02, weight_03]
weights = get_properly_arranged_t2i_weights(weights)
weights.reverse() # to account for recent ComfyUI changes
weights = ControlWeights.t2iadapter(weights, flip_weights=flip_weights, uncond_multiplier=uncond_multiplier, extras=cn_extras)
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))
@@ -229,5 +230,6 @@ class CustomT2IAdapterWeights:
uncond_multiplier: float=1.0, cn_extras: dict[str]={}):
weights = [weight_00, weight_01, weight_02, weight_03]
weights = get_properly_arranged_t2i_weights(weights)
weights.reverse() # to account for recent ComfyUI changes
weights = ControlWeights.t2iadapter(weights, flip_weights=flip_weights, uncond_multiplier=uncond_multiplier, extras=cn_extras)
return (weights, TimestepKeyframeGroup.default(TimestepKeyframe(control_weights=weights)))