Compare commits

...

4 Commits

Author SHA1 Message Date
Silver
45eb301c1e
Merge 7d493629a4 into b8f848bfe3 2026-01-31 07:26:41 +01:00
comfyanonymous
b8f848bfe3
Fix model not working with any res. (#12186) 2026-01-31 00:12:48 -05:00
comfyanonymous
4064062e7d
Update python patch version in dep workflow. (#12184) 2026-01-30 20:20:06 -05:00
Silver
7d493629a4
Separate Int node without control_after_generate
Separate integer primitive that does not contain randomizing function which will act as primary integer primitive and for integers with randomizing, a new primitive named RandInt instead. 

This will greatly reduce canvas clutter when using primitive integer for purposes like steps, resolution and other use cases that does not need randomization nor are related to seed.

Having the randomizing element always present also runs the risk of the user accidentally leaving node at random on a primitive that then passes that value to a node that causes server to hang because of it. Possibly even worse.
2025-10-15 03:06:19 +02:00
3 changed files with 25 additions and 3 deletions

View File

@ -29,7 +29,7 @@ on:
description: 'python patch version'
required: true
type: string
default: "9"
default: "11"
# push:
# branches:
# - master

View File

@ -13,6 +13,7 @@ from torchvision import transforms
import comfy.patcher_extension
from comfy.ldm.modules.attention import optimized_attention
import comfy.ldm.common_dit
def apply_rotary_pos_emb(
t: torch.Tensor,
@ -835,6 +836,8 @@ class MiniTrainDIT(nn.Module):
padding_mask: Optional[torch.Tensor] = None,
**kwargs,
):
orig_shape = list(x.shape)
x = comfy.ldm.common_dit.pad_to_patch_size(x, (self.patch_temporal, self.patch_spatial, self.patch_spatial))
x_B_C_T_H_W = x
timesteps_B_T = timesteps
crossattn_emb = context
@ -882,5 +885,5 @@ class MiniTrainDIT(nn.Module):
)
x_B_T_H_W_O = self.final_layer(x_B_T_H_W_D, t_embedding_B_T_D, adaln_lora_B_T_3D=adaln_lora_B_T_3D)
x_B_C_Tt_Hp_Wp = self.unpatchify(x_B_T_H_W_O)
x_B_C_Tt_Hp_Wp = self.unpatchify(x_B_T_H_W_O)[:, :, :orig_shape[-3], :orig_shape[-2], :orig_shape[-1]]
return x_B_C_Tt_Hp_Wp

View File

@ -40,6 +40,24 @@ class StringMultiline(io.ComfyNode):
return io.NodeOutput(value)
class RandInt(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="PrimitiveRandomInt",
display_name="RandomInt",
category="utils/primitive",
inputs=[
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize, control_after_generate=True),
],
outputs=[io.Int.Output()],
)
@classmethod
def execute(cls, value: int) -> io.NodeOutput:
return io.NodeOutput(value)
class Int(io.ComfyNode):
@classmethod
def define_schema(cls):
@ -48,7 +66,7 @@ class Int(io.ComfyNode):
display_name="Int",
category="utils/primitive",
inputs=[
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize, control_after_generate=True),
io.Int.Input("value", min=-sys.maxsize, max=sys.maxsize),
],
outputs=[io.Int.Output()],
)
@ -100,6 +118,7 @@ class PrimitivesExtension(ComfyExtension):
return [
String,
StringMultiline,
RandInt,
Int,
Float,
Boolean,