Download custom_nodes/comfy_mtb/nodes/latent_processing.py from fotographerai/Zen-Style-Shape: direct link, hf CLI and curl.
- Browser
- Download file 726 Bytes
-
https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/custom_nodes/comfy_mtb/nodes/latent_processing.py
- Command line
-
hf download hf://spaces/fotographerai/Zen-Style-Shape@1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/custom_nodes/comfy_mtb/nodes/latent_processing.py
-
curl -L -o latent_processing.py https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/custom_nodes/comfy_mtb/nodes/latent_processing.py
726 Bytes
| import torch | |
| class MTB_LatentLerp: | |
| """Linear interpolation (blend) between two latent vectors""" | |
| def INPUT_TYPES(cls): | |
| return { | |
| "required": { | |
| "A": ("LATENT",), | |
| "B": ("LATENT",), | |
| "t": ( | |
| "FLOAT", | |
| {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}, | |
| ), | |
| } | |
| } | |
| RETURN_TYPES = ("LATENT",) | |
| FUNCTION = "lerp_latent" | |
| CATEGORY = "mtb/latent" | |
| def lerp_latent(self, A, B, t): | |
| a = A.copy() | |
| b = B.copy() | |
| torch.lerp(a["samples"], b["samples"], t, out=a["samples"]) | |
| return (a,) | |
| __nodes__ = [ | |
| MTB_LatentLerp, | |
| ] | |