This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| class VisualStylePrompting: | |
| @classmethod | |
| def INPUT_TYPES(s): | |
| return {"required": { | |
| "model": ("MODEL",), | |
| "reference": ("LATENT",), | |
| "depth": ("INT", {"default": 0, "min": -1, "max": 12}), | |
| "batch_size": ("INT", {"default": 1, "min": 1, "max": 64}), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ref: ScaleCrafter https://github.com/YingqingHe/ScaleCrafter | |
| import math | |
| import comfy.ops | |
| import torch.nn.functional as F | |
| ops = comfy.ops.disable_weight_init | |
| class ScaleCrafter: | |
| @classmethod | |
| def INPUT_TYPES(s): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://arxiv.org/abs/2310.07702 | |
| import comfy.ops | |
| ops = comfy.ops.disable_weight_init | |
| class DilateConv: | |
| @classmethod | |
| def INPUT_TYPES(s): | |
| return { | |
| "required": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =========================================================================================================================================================== | |
| Layer (type (var_name)) Input Shape Output Shape Param # Kernel Shape | |
| =========================================================================================================================================================== | |
| StableCascadeUnet (StableCascadeUnet) -- [1, 4, 256, 256] -- 3 | |
| ├─Linear (clip_txt_pooled_mapper) [1, 1, 1280] [1, 1, 5120] 6,558,720 -- | |
| ├─LayerNorm (clip_norm) [1, 4, 1280] [1, 4, 1280] -- -- | |
| ├─Sequential (embedding) [1, 4, 256, 256] [1, 320, 128, 128] -- -- | |
| │ └─PixelUnshuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =========================================================================================================================================================== | |
| Layer (type (var_name)) Input Shape Output Shape Param # Kernel Shape | |
| =========================================================================================================================================================== | |
| StableCascadeUnet (StableCascadeUnet) [2, 16, 24, 24] [2, 16, 24, 24] 8,923,136 3 | |
| ├─Linear (clip_txt_pooled_mapper) [2, 77, 1280] [2, 77, 8192] 10,493,952 -- | |
| ├─LayerNorm (clip_norm) [2, 308, 2048] [2, 308, 2048] -- -- | |
| ├─Sequential (embedding) [2, 16, 24, 24] [2, 2048, 24, 24] -- -- | |
| │ └─PixelUnshuf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| load from sampling/custom_sampling/scheulers | |
| input text like "999,893,...,156" | |
| connect to SamplerCustom | |
| ''' | |
| import torch | |
| class TextScheduler: | |
| @classmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Implementation of RCFG in https://arxiv.org/abs/2312.12491 | |
| Node is in sampling/custom_sampling/samplers | |
| original_latent is OPTIONAL | |
| If original_latent is set, it is Self-Negative else Onetime-Negative | |
| cfg is recommendet near 1.0 (KSAMPLER"s cfg is ignored) | |
| delta is よくわかんない | |
| ''' | |
| from comfy.samplers import KSAMPLER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| https://arxiv.org/abs/2312.00858 | |
| 1. put this file in ComfyUI/custom_nodes | |
| 2. load node from <loaders> | |
| start_step, end_step: apply this method when the timestep is between start_step and end_step | |
| cache_interval: interval of caching (1 means no caching) | |
| cache_depth: depth of caching | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import comfy | |
| from comfy.samplers import KSAMPLER | |
| import torch | |
| from torchvision.transforms.functional import gaussian_blur | |
| from comfy.k_diffusion.sampling import default_noise_sampler, get_ancestral_step, to_d, BrownianTreeNoiseSampler | |
| from tqdm.auto import trange | |
| def interpolate(x, size, unsharp_strength=0.0, unsharp_kernel_size=3, unsharp_sigma=0.5, unsharp=False, mode="bicubic", align_corners=False): | |
| x = torch.nn.functional.interpolate(x, size=size, mode=mode, align_corners=align_corners) | |
| if unsharp_strength > 0 and unsharp: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import comfy | |
| from comfy.samplers import KSAMPLER | |
| import torch | |
| from comfy.k_diffusion.sampling import default_noise_sampler, get_ancestral_step, to_d, BrownianTreeNoiseSampler | |
| from tqdm.auto import trange | |
| @torch.no_grad() | |
| def sample_euler_ancestral(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, upscale_ratio=2.0, start_step=5, end_step=15, upscale_n_step=3): | |
| """Ancestral sampling with Euler method steps.""" | |
| extra_args = {} if extra_args is None else extra_args |