This commit is contained in:
logtd
2024-03-21 23:02:40 -06:00
parent f69dde2e62
commit ea48f4ba4b
3 changed files with 1085 additions and 1 deletions
+3 -1
View File
@@ -1,10 +1,12 @@
from .nodes import SamplerInversedEulerNode
from .nodes import SamplerInversedEulerNode, MixNoiseNode
NODE_CLASS_MAPPINGS = {
"SamplerInversedEulerNode": SamplerInversedEulerNode,
"MixNoiseNode": MixNoiseNode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"SamplerInversedEulerNode": "Inversed Euler Sampler",
"MixNoiseNode": "Mix Noise with Latent"
}
File diff suppressed because it is too large Load Diff
+25
View File
@@ -44,3 +44,28 @@ class SamplerInversedEulerNode:
ksampler = KSAMPLER(sample_inversed_euler)
return (ksampler, )
# combined_noise = ((1 - randomness) * rec_noise + randomness * rand_noise) / ((randomness**2 + (1-randomness)**2) ** 0.5)
class MixNoiseNode:
@classmethod
def INPUT_TYPES(s):
return {"required": {
"latent": ("LATENT", ),
"randomness": ("FLOAT", {"default": 0.1, "min": 0.0, "max": 1.0, "step": 0.01, "round": False}),
}}
RETURN_TYPES = ("LATENT",)
CATEGORY = "sampling/custom_sampling/samplers"
FUNCTION = "combine"
def combine(self, latent, randomness):
latent_image = latent['samples']
rand_noise = torch.randn_like(latent_image)
combined_noise = ((1 - randomness) * latent_image + randomness *
rand_noise) / ((randomness**2 + (1-randomness)**2) ** 0.5)
latent = latent.copy()
latent['samples'] = combined_noise
return (latent, )