mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Remove some trailing white space.
This commit is contained in:
parent
9cfd185676
commit
d170292594
@ -120,7 +120,7 @@ class ControlBase:
|
|||||||
if self.previous_controlnet is not None:
|
if self.previous_controlnet is not None:
|
||||||
out += self.previous_controlnet.get_models()
|
out += self.previous_controlnet.get_models()
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def get_extra_hooks(self):
|
def get_extra_hooks(self):
|
||||||
out = []
|
out = []
|
||||||
if self.extra_hooks is not None:
|
if self.extra_hooks is not None:
|
||||||
|
@ -80,7 +80,7 @@ class NoiseScheduleVP:
|
|||||||
'linear' or 'cosine' for continuous-time DPMs.
|
'linear' or 'cosine' for continuous-time DPMs.
|
||||||
Returns:
|
Returns:
|
||||||
A wrapper object of the forward SDE (VP type).
|
A wrapper object of the forward SDE (VP type).
|
||||||
|
|
||||||
===============================================================
|
===============================================================
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -208,7 +208,7 @@ def model_wrapper(
|
|||||||
arXiv preprint arXiv:2202.00512 (2022).
|
arXiv preprint arXiv:2202.00512 (2022).
|
||||||
[2] Ho, Jonathan, et al. "Imagen Video: High Definition Video Generation with Diffusion Models."
|
[2] Ho, Jonathan, et al. "Imagen Video: High Definition Video Generation with Diffusion Models."
|
||||||
arXiv preprint arXiv:2210.02303 (2022).
|
arXiv preprint arXiv:2210.02303 (2022).
|
||||||
|
|
||||||
4. "score": marginal score function. (Trained by denoising score matching).
|
4. "score": marginal score function. (Trained by denoising score matching).
|
||||||
Note that the score function and the noise prediction model follows a simple relationship:
|
Note that the score function and the noise prediction model follows a simple relationship:
|
||||||
```
|
```
|
||||||
@ -245,7 +245,7 @@ def model_wrapper(
|
|||||||
|
|
||||||
[4] Ho, Jonathan, and Tim Salimans. "Classifier-free diffusion guidance."
|
[4] Ho, Jonathan, and Tim Salimans. "Classifier-free diffusion guidance."
|
||||||
arXiv preprint arXiv:2207.12598 (2022).
|
arXiv preprint arXiv:2207.12598 (2022).
|
||||||
|
|
||||||
|
|
||||||
The `t_input` is the time label of the model, which may be discrete-time labels (i.e. 0 to 999)
|
The `t_input` is the time label of the model, which may be discrete-time labels (i.e. 0 to 999)
|
||||||
or continuous-time labels (i.e. epsilon to T).
|
or continuous-time labels (i.e. epsilon to T).
|
||||||
@ -621,7 +621,7 @@ class UniPC:
|
|||||||
B_h = torch.expm1(hh)
|
B_h = torch.expm1(hh)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
for i in range(1, order + 1):
|
for i in range(1, order + 1):
|
||||||
R.append(torch.pow(rks, i - 1))
|
R.append(torch.pow(rks, i - 1))
|
||||||
b.append(h_phi_k * factorial_i / B_h)
|
b.append(h_phi_k * factorial_i / B_h)
|
||||||
@ -870,4 +870,4 @@ def sample_unipc(model, noise, sigmas, extra_args=None, callback=None, disable=F
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
def sample_unipc_bh2(model, noise, sigmas, extra_args=None, callback=None, disable=False):
|
def sample_unipc_bh2(model, noise, sigmas, extra_args=None, callback=None, disable=False):
|
||||||
return sample_unipc(model, noise, sigmas, extra_args, callback, disable, variant='bh2')
|
return sample_unipc(model, noise, sigmas, extra_args, callback, disable, variant='bh2')
|
||||||
|
@ -101,7 +101,7 @@ class WeightHook(Hook):
|
|||||||
self.need_weight_init = True
|
self.need_weight_init = True
|
||||||
self._strength_model = strength_model
|
self._strength_model = strength_model
|
||||||
self._strength_clip = strength_clip
|
self._strength_clip = strength_clip
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def strength_model(self):
|
def strength_model(self):
|
||||||
return self._strength_model * self.strength
|
return self._strength_model * self.strength
|
||||||
|
@ -1230,7 +1230,7 @@ def sample_dpmpp_2m_cfg_pp(model, x, sigmas, extra_args=None, callback=None, dis
|
|||||||
nonlocal uncond_denoised
|
nonlocal uncond_denoised
|
||||||
uncond_denoised = args["uncond_denoised"]
|
uncond_denoised = args["uncond_denoised"]
|
||||||
return args["denoised"]
|
return args["denoised"]
|
||||||
|
|
||||||
model_options = extra_args.get("model_options", {}).copy()
|
model_options = extra_args.get("model_options", {}).copy()
|
||||||
extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True)
|
extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True)
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ def efficient_dot_product_attention(
|
|||||||
value=value,
|
value=value,
|
||||||
mask=mask,
|
mask=mask,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: maybe we should use torch.empty_like(query) to allocate storage in-advance,
|
# TODO: maybe we should use torch.empty_like(query) to allocate storage in-advance,
|
||||||
# and pass slices to be mutated, instead of torch.cat()ing the returned slices
|
# and pass slices to be mutated, instead of torch.cat()ing the returned slices
|
||||||
res = torch.cat([
|
res = torch.cat([
|
||||||
|
@ -223,7 +223,7 @@ class PixArtMS(nn.Module):
|
|||||||
if self.micro_conditioning:
|
if self.micro_conditioning:
|
||||||
if c_size is None:
|
if c_size is None:
|
||||||
c_size = torch.tensor([H*8, W*8], dtype=x.dtype, device=x.device).repeat(B, 1)
|
c_size = torch.tensor([H*8, W*8], dtype=x.dtype, device=x.device).repeat(B, 1)
|
||||||
|
|
||||||
if c_ar is None:
|
if c_ar is None:
|
||||||
c_ar = torch.tensor([H/W], dtype=x.dtype, device=x.device).repeat(B, 1)
|
c_ar = torch.tensor([H/W], dtype=x.dtype, device=x.device).repeat(B, 1)
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ def detect_unet_config(state_dict, key_prefix):
|
|||||||
if pe_key in state_dict_keys:
|
if pe_key in state_dict_keys:
|
||||||
dit_config["input_size"] = int(math.sqrt(state_dict[pe_key].shape[1])) * patch_size
|
dit_config["input_size"] = int(math.sqrt(state_dict[pe_key].shape[1])) * patch_size
|
||||||
dit_config["pe_interpolation"] = dit_config["input_size"] // (512//8) # guess
|
dit_config["pe_interpolation"] = dit_config["input_size"] // (512//8) # guess
|
||||||
|
|
||||||
ar_key = "{}ar_embedder.mlp.0.weight".format(key_prefix)
|
ar_key = "{}ar_embedder.mlp.0.weight".format(key_prefix)
|
||||||
if ar_key in state_dict_keys:
|
if ar_key in state_dict_keys:
|
||||||
dit_config["image_model"] = "pixart_alpha"
|
dit_config["image_model"] = "pixart_alpha"
|
||||||
@ -571,7 +571,7 @@ def unet_config_from_diffusers_unet(state_dict, dtype=None):
|
|||||||
'transformer_depth': [0, 1, 1], 'channel_mult': [1, 2, 4], 'transformer_depth_middle': -2, 'use_linear_in_transformer': False,
|
'transformer_depth': [0, 1, 1], 'channel_mult': [1, 2, 4], 'transformer_depth_middle': -2, 'use_linear_in_transformer': False,
|
||||||
'context_dim': 768, 'num_head_channels': 64, 'transformer_depth_output': [0, 0, 1, 1, 1, 1],
|
'context_dim': 768, 'num_head_channels': 64, 'transformer_depth_output': [0, 0, 1, 1, 1, 1],
|
||||||
'use_temporal_attention': False, 'use_temporal_resblock': False}
|
'use_temporal_attention': False, 'use_temporal_resblock': False}
|
||||||
|
|
||||||
SD15_diffusers_inpaint = {'use_checkpoint': False, 'image_size': 32, 'out_channels': 4, 'use_spatial_transformer': True, 'legacy': False, 'adm_in_channels': None,
|
SD15_diffusers_inpaint = {'use_checkpoint': False, 'image_size': 32, 'out_channels': 4, 'use_spatial_transformer': True, 'legacy': False, 'adm_in_channels': None,
|
||||||
'dtype': dtype, 'in_channels': 9, 'model_channels': 320, 'num_res_blocks': [2, 2, 2, 2], 'transformer_depth': [1, 1, 1, 1, 1, 1, 0, 0],
|
'dtype': dtype, 'in_channels': 9, 'model_channels': 320, 'num_res_blocks': [2, 2, 2, 2], 'transformer_depth': [1, 1, 1, 1, 1, 1, 0, 0],
|
||||||
'channel_mult': [1, 2, 4, 4], 'transformer_depth_middle': 1, 'use_linear_in_transformer': False, 'context_dim': 768, 'num_heads': 8,
|
'channel_mult': [1, 2, 4, 4], 'transformer_depth_middle': 1, 'use_linear_in_transformer': False, 'context_dim': 768, 'num_heads': 8,
|
||||||
|
@ -13,7 +13,7 @@ def prepare_noise(latent_image, seed, noise_inds=None):
|
|||||||
generator = torch.manual_seed(seed)
|
generator = torch.manual_seed(seed)
|
||||||
if noise_inds is None:
|
if noise_inds is None:
|
||||||
return torch.randn(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, generator=generator, device="cpu")
|
return torch.randn(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, generator=generator, device="cpu")
|
||||||
|
|
||||||
unique_inds, inverse = np.unique(noise_inds, return_inverse=True)
|
unique_inds, inverse = np.unique(noise_inds, return_inverse=True)
|
||||||
noises = []
|
noises = []
|
||||||
for i in range(unique_inds[-1]+1):
|
for i in range(unique_inds[-1]+1):
|
||||||
|
@ -42,7 +42,7 @@ def get_hooks_from_cond(cond, hooks_dict: dict[comfy.hooks.EnumHookType, dict[co
|
|||||||
if cnet.previous_controlnet is None:
|
if cnet.previous_controlnet is None:
|
||||||
return _list
|
return _list
|
||||||
return get_extra_hooks_from_cnet(cnet.previous_controlnet, _list)
|
return get_extra_hooks_from_cnet(cnet.previous_controlnet, _list)
|
||||||
|
|
||||||
hooks_list = []
|
hooks_list = []
|
||||||
cnets = set(cnets)
|
cnets = set(cnets)
|
||||||
for base_cnet in cnets:
|
for base_cnet in cnets:
|
||||||
|
@ -455,7 +455,7 @@ def pixart_to_diffusers(mmdit_config, output_prefix=""):
|
|||||||
|
|
||||||
for k in PIXART_MAP_BASIC:
|
for k in PIXART_MAP_BASIC:
|
||||||
key_map[k[1]] = "{}{}".format(output_prefix, k[0])
|
key_map[k[1]] = "{}{}".format(output_prefix, k[0])
|
||||||
|
|
||||||
return key_map
|
return key_map
|
||||||
|
|
||||||
def auraflow_to_diffusers(mmdit_config, output_prefix=""):
|
def auraflow_to_diffusers(mmdit_config, output_prefix=""):
|
||||||
@ -702,7 +702,7 @@ def get_attr(obj, attr):
|
|||||||
def bislerp(samples, width, height):
|
def bislerp(samples, width, height):
|
||||||
def slerp(b1, b2, r):
|
def slerp(b1, b2, r):
|
||||||
'''slerps batches b1, b2 according to ratio r, batches should be flat e.g. NxC'''
|
'''slerps batches b1, b2 according to ratio r, batches should be flat e.g. NxC'''
|
||||||
|
|
||||||
c = b1.shape[-1]
|
c = b1.shape[-1]
|
||||||
|
|
||||||
#norms
|
#norms
|
||||||
@ -730,13 +730,13 @@ def bislerp(samples, width, height):
|
|||||||
res[dot > 1 - 1e-5] = b1[dot > 1 - 1e-5]
|
res[dot > 1 - 1e-5] = b1[dot > 1 - 1e-5]
|
||||||
res[dot < 1e-5 - 1] = (b1 * (1.0-r) + b2 * r)[dot < 1e-5 - 1]
|
res[dot < 1e-5 - 1] = (b1 * (1.0-r) + b2 * r)[dot < 1e-5 - 1]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def generate_bilinear_data(length_old, length_new, device):
|
def generate_bilinear_data(length_old, length_new, device):
|
||||||
coords_1 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1))
|
coords_1 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1))
|
||||||
coords_1 = torch.nn.functional.interpolate(coords_1, size=(1, length_new), mode="bilinear")
|
coords_1 = torch.nn.functional.interpolate(coords_1, size=(1, length_new), mode="bilinear")
|
||||||
ratios = coords_1 - coords_1.floor()
|
ratios = coords_1 - coords_1.floor()
|
||||||
coords_1 = coords_1.to(torch.int64)
|
coords_1 = coords_1.to(torch.int64)
|
||||||
|
|
||||||
coords_2 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1)) + 1
|
coords_2 = torch.arange(length_old, dtype=torch.float32, device=device).reshape((1,1,1,-1)) + 1
|
||||||
coords_2[:,:,:,-1] -= 1
|
coords_2[:,:,:,-1] -= 1
|
||||||
coords_2 = torch.nn.functional.interpolate(coords_2, size=(1, length_new), mode="bilinear")
|
coords_2 = torch.nn.functional.interpolate(coords_2, size=(1, length_new), mode="bilinear")
|
||||||
@ -747,7 +747,7 @@ def bislerp(samples, width, height):
|
|||||||
samples = samples.float()
|
samples = samples.float()
|
||||||
n,c,h,w = samples.shape
|
n,c,h,w = samples.shape
|
||||||
h_new, w_new = (height, width)
|
h_new, w_new = (height, width)
|
||||||
|
|
||||||
#linear w
|
#linear w
|
||||||
ratios, coords_1, coords_2 = generate_bilinear_data(w, w_new, samples.device)
|
ratios, coords_1, coords_2 = generate_bilinear_data(w, w_new, samples.device)
|
||||||
coords_1 = coords_1.expand((n, c, h, -1))
|
coords_1 = coords_1.expand((n, c, h, -1))
|
||||||
|
@ -305,7 +305,7 @@ class FeatherMask:
|
|||||||
output[:, -y, :] *= feather_rate
|
output[:, -y, :] *= feather_rate
|
||||||
|
|
||||||
return (output,)
|
return (output,)
|
||||||
|
|
||||||
class GrowMask:
|
class GrowMask:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def INPUT_TYPES(cls):
|
||||||
@ -316,7 +316,7 @@ class GrowMask:
|
|||||||
"tapered_corners": ("BOOLEAN", {"default": True}),
|
"tapered_corners": ("BOOLEAN", {"default": True}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
CATEGORY = "mask"
|
CATEGORY = "mask"
|
||||||
|
|
||||||
RETURN_TYPES = ("MASK",)
|
RETURN_TYPES = ("MASK",)
|
||||||
|
@ -64,7 +64,7 @@ class Guider_PerpNeg(comfy.samplers.CFGGuider):
|
|||||||
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
||||||
# in CFGGuider.predict_noise, we call sampling_function(), which uses cfg_function() to compute pos & neg
|
# in CFGGuider.predict_noise, we call sampling_function(), which uses cfg_function() to compute pos & neg
|
||||||
# but we'd rather do a single batch of sampling pos, neg, and empty, so we call calc_cond_batch([pos,neg,empty]) directly
|
# but we'd rather do a single batch of sampling pos, neg, and empty, so we call calc_cond_batch([pos,neg,empty]) directly
|
||||||
|
|
||||||
positive_cond = self.conds.get("positive", None)
|
positive_cond = self.conds.get("positive", None)
|
||||||
negative_cond = self.conds.get("negative", None)
|
negative_cond = self.conds.get("negative", None)
|
||||||
empty_cond = self.conds.get("empty_negative_prompt", None)
|
empty_cond = self.conds.get("empty_negative_prompt", None)
|
||||||
|
@ -40,7 +40,7 @@ class LatentRebatch:
|
|||||||
return slices, indexable[num * batch_size:]
|
return slices, indexable[num * batch_size:]
|
||||||
else:
|
else:
|
||||||
return slices, None
|
return slices, None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def slice_batch(batch, num, batch_size):
|
def slice_batch(batch, num, batch_size):
|
||||||
result = [LatentRebatch.get_slices(x, num, batch_size) for x in batch]
|
result = [LatentRebatch.get_slices(x, num, batch_size) for x in batch]
|
||||||
@ -81,7 +81,7 @@ class LatentRebatch:
|
|||||||
if current_batch[0].shape[0] > batch_size:
|
if current_batch[0].shape[0] > batch_size:
|
||||||
num = current_batch[0].shape[0] // batch_size
|
num = current_batch[0].shape[0] // batch_size
|
||||||
sliced, remainder = self.slice_batch(current_batch, num, batch_size)
|
sliced, remainder = self.slice_batch(current_batch, num, batch_size)
|
||||||
|
|
||||||
for i in range(num):
|
for i in range(num):
|
||||||
output_list.append({'samples': sliced[0][i], 'noise_mask': sliced[1][i], 'batch_index': sliced[2][i]})
|
output_list.append({'samples': sliced[0][i], 'noise_mask': sliced[1][i], 'batch_index': sliced[2][i]})
|
||||||
|
|
||||||
|
@ -40,9 +40,8 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
|
|||||||
return do_nothing, do_nothing
|
return do_nothing, do_nothing
|
||||||
|
|
||||||
gather = mps_gather_workaround if metric.device.type == "mps" else torch.gather
|
gather = mps_gather_workaround if metric.device.type == "mps" else torch.gather
|
||||||
|
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
|
|
||||||
hsy, wsx = h // sy, w // sx
|
hsy, wsx = h // sy, w // sx
|
||||||
|
|
||||||
# For each sy by sx kernel, randomly assign one token to be dst and the rest src
|
# For each sy by sx kernel, randomly assign one token to be dst and the rest src
|
||||||
@ -50,7 +49,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
|
|||||||
rand_idx = torch.zeros(hsy, wsx, 1, device=metric.device, dtype=torch.int64)
|
rand_idx = torch.zeros(hsy, wsx, 1, device=metric.device, dtype=torch.int64)
|
||||||
else:
|
else:
|
||||||
rand_idx = torch.randint(sy*sx, size=(hsy, wsx, 1), device=metric.device)
|
rand_idx = torch.randint(sy*sx, size=(hsy, wsx, 1), device=metric.device)
|
||||||
|
|
||||||
# The image might not divide sx and sy, so we need to work on a view of the top left if the idx buffer instead
|
# The image might not divide sx and sy, so we need to work on a view of the top left if the idx buffer instead
|
||||||
idx_buffer_view = torch.zeros(hsy, wsx, sy*sx, device=metric.device, dtype=torch.int64)
|
idx_buffer_view = torch.zeros(hsy, wsx, sy*sx, device=metric.device, dtype=torch.int64)
|
||||||
idx_buffer_view.scatter_(dim=2, index=rand_idx, src=-torch.ones_like(rand_idx, dtype=rand_idx.dtype))
|
idx_buffer_view.scatter_(dim=2, index=rand_idx, src=-torch.ones_like(rand_idx, dtype=rand_idx.dtype))
|
||||||
@ -99,7 +98,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
|
|||||||
def merge(x: torch.Tensor, mode="mean") -> torch.Tensor:
|
def merge(x: torch.Tensor, mode="mean") -> torch.Tensor:
|
||||||
src, dst = split(x)
|
src, dst = split(x)
|
||||||
n, t1, c = src.shape
|
n, t1, c = src.shape
|
||||||
|
|
||||||
unm = gather(src, dim=-2, index=unm_idx.expand(n, t1 - r, c))
|
unm = gather(src, dim=-2, index=unm_idx.expand(n, t1 - r, c))
|
||||||
src = gather(src, dim=-2, index=src_idx.expand(n, r, c))
|
src = gather(src, dim=-2, index=src_idx.expand(n, r, c))
|
||||||
dst = dst.scatter_reduce(-2, dst_idx.expand(n, r, c), src, reduce=mode)
|
dst = dst.scatter_reduce(-2, dst_idx.expand(n, r, c), src, reduce=mode)
|
||||||
|
20
nodes.py
20
nodes.py
@ -65,7 +65,7 @@ class CLIPTextEncode(ComfyNodeABC):
|
|||||||
def encode(self, clip, text):
|
def encode(self, clip, text):
|
||||||
tokens = clip.tokenize(text)
|
tokens = clip.tokenize(text)
|
||||||
return (clip.encode_from_tokens_scheduled(tokens), )
|
return (clip.encode_from_tokens_scheduled(tokens), )
|
||||||
|
|
||||||
|
|
||||||
class ConditioningCombine:
|
class ConditioningCombine:
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -641,7 +641,7 @@ class LoraLoader:
|
|||||||
"strength_clip": ("FLOAT", {"default": 1.0, "min": -100.0, "max": 100.0, "step": 0.01, "tooltip": "How strongly to modify the CLIP model. This value can be negative."}),
|
"strength_clip": ("FLOAT", {"default": 1.0, "min": -100.0, "max": 100.0, "step": 0.01, "tooltip": "How strongly to modify the CLIP model. This value can be negative."}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_TYPES = ("MODEL", "CLIP")
|
RETURN_TYPES = ("MODEL", "CLIP")
|
||||||
OUTPUT_TOOLTIPS = ("The modified diffusion model.", "The modified CLIP model.")
|
OUTPUT_TOOLTIPS = ("The modified diffusion model.", "The modified CLIP model.")
|
||||||
FUNCTION = "load_lora"
|
FUNCTION = "load_lora"
|
||||||
@ -1211,7 +1211,7 @@ class LatentFromBatch:
|
|||||||
else:
|
else:
|
||||||
s["batch_index"] = samples["batch_index"][batch_index:batch_index + length]
|
s["batch_index"] = samples["batch_index"][batch_index:batch_index + length]
|
||||||
return (s,)
|
return (s,)
|
||||||
|
|
||||||
class RepeatLatentBatch:
|
class RepeatLatentBatch:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@ -1226,7 +1226,7 @@ class RepeatLatentBatch:
|
|||||||
def repeat(self, samples, amount):
|
def repeat(self, samples, amount):
|
||||||
s = samples.copy()
|
s = samples.copy()
|
||||||
s_in = samples["samples"]
|
s_in = samples["samples"]
|
||||||
|
|
||||||
s["samples"] = s_in.repeat((amount, 1,1,1))
|
s["samples"] = s_in.repeat((amount, 1,1,1))
|
||||||
if "noise_mask" in samples and samples["noise_mask"].shape[0] > 1:
|
if "noise_mask" in samples and samples["noise_mask"].shape[0] > 1:
|
||||||
masks = samples["noise_mask"]
|
masks = samples["noise_mask"]
|
||||||
@ -1636,15 +1636,15 @@ class LoadImage:
|
|||||||
FUNCTION = "load_image"
|
FUNCTION = "load_image"
|
||||||
def load_image(self, image):
|
def load_image(self, image):
|
||||||
image_path = folder_paths.get_annotated_filepath(image)
|
image_path = folder_paths.get_annotated_filepath(image)
|
||||||
|
|
||||||
img = node_helpers.pillow(Image.open, image_path)
|
img = node_helpers.pillow(Image.open, image_path)
|
||||||
|
|
||||||
output_images = []
|
output_images = []
|
||||||
output_masks = []
|
output_masks = []
|
||||||
w, h = None, None
|
w, h = None, None
|
||||||
|
|
||||||
excluded_formats = ['MPO']
|
excluded_formats = ['MPO']
|
||||||
|
|
||||||
for i in ImageSequence.Iterator(img):
|
for i in ImageSequence.Iterator(img):
|
||||||
i = node_helpers.pillow(ImageOps.exif_transpose, i)
|
i = node_helpers.pillow(ImageOps.exif_transpose, i)
|
||||||
|
|
||||||
@ -1655,10 +1655,10 @@ class LoadImage:
|
|||||||
if len(output_images) == 0:
|
if len(output_images) == 0:
|
||||||
w = image.size[0]
|
w = image.size[0]
|
||||||
h = image.size[1]
|
h = image.size[1]
|
||||||
|
|
||||||
if image.size[0] != w or image.size[1] != h:
|
if image.size[0] != w or image.size[1] != h:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
image = np.array(image).astype(np.float32) / 255.0
|
image = np.array(image).astype(np.float32) / 255.0
|
||||||
image = torch.from_numpy(image)[None,]
|
image = torch.from_numpy(image)[None,]
|
||||||
if 'A' in i.getbands():
|
if 'A' in i.getbands():
|
||||||
@ -2234,5 +2234,5 @@ def init_extra_nodes(init_custom_nodes=True):
|
|||||||
else:
|
else:
|
||||||
logging.warning("Please do a: pip install -r requirements.txt")
|
logging.warning("Please do a: pip install -r requirements.txt")
|
||||||
logging.warning("")
|
logging.warning("")
|
||||||
|
|
||||||
return import_failed
|
return import_failed
|
||||||
|
Loading…
Reference in New Issue
Block a user