Skip to content

Conversation

bigcat88
Copy link
Contributor

@bigcat88 bigcat88 commented Jul 21, 2025

V1 node code:

def load_clip(self, clip_name1, clip_name2, clip_name3):
    clip_path1 = folder_paths.get_full_path_or_raise("text_encoders", clip_name1)
    clip_path2 = folder_paths.get_full_path_or_raise("text_encoders", clip_name2)
    clip_path3 = folder_paths.get_full_path_or_raise("text_encoders", clip_name3)
    clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2, clip_path3], embedding_directory=folder_paths.get_folder_paths("embeddings"))
    return (clip,)

V3 node code(reverted to V1 version in last commit):

@classmethod
def execute(cls, clip_name1: str, clip_name2: str, clip_name3: str):
    clip_data =[
        cls.resources.get(resources.TorchDictFolderFilename("text_encoders", clip_name1)),
        cls.resources.get(resources.TorchDictFolderFilename("text_encoders", clip_name2)),
        cls.resources.get(resources.TorchDictFolderFilename("text_encoders", clip_name3)),
    ]
    return io.NodeOutput(
        comfy.sd.load_text_encoder_state_dicts(
            clip_data, embedding_directory=folder_paths.get_folder_paths("embeddings")
        )
    )

V1 node code:

def skip_guidance_sd3(self, model, layers, scale, start_percent, end_percent):
    return self.skip_guidance(model=model, scale=scale, start_percent=start_percent, end_percent=end_percent, double_layers=layers)

V3 node code:

@classmethod
def execute(cls, model, layers: str, scale: float, start_percent: float, end_percent: float):
    return SkipLayerGuidanceDiT.execute(
        model=model, scale=scale, start_percent=start_percent, end_percent=end_percent, double_layers=layers
    )

SkipLayerGuidanceSD3 still inherits from SkipLayerGuidanceDiT, we just not using super() as it will result in a runtime error. This was fixed by Kosinkadink

The downsides of this is that child class can not override parent class variables(not required by this node), for example:

class TestOne(io.ComfyNodeV3):
    TEST_VAR = 1
    
    @classmethod
    def execute(cls):
        print(cls.TEST_VAR)  # will print "1"
    
    
class TestTwo(TestOne):
    TEST_VAR = 2

    @classmethod
    def execute(cls):
        print(cls.TEST_VAR)  # will print "2"
        TestOne.execute()    # will print "1"

SelfAttention test:

Screenshot from 2025-07-19 17-54-28

SD3 nodes test:

Screenshot from 2025-07-21 07-33-53

@Kosinkadink
Copy link
Collaborator

I found the source of the super() bug you encountered, and the fix has been merged into v3-definition. See if that lets you rewrite it!

For the cls.resources.get(resources.TorchDictFolderFilename("text_encoders", clip_name1)) stuff, for now keep it the way it was in V1. There is still a lot of work left on getting the resources stuff the way we'd like, and currently it caches it locally on a node, which is only something intended for lora load caching.

@Kosinkadink Kosinkadink added the v3 label Jul 22, 2025
@bigcat88 bigcat88 force-pushed the v3/nodes/nodes-part1-s-letter branch from 1011ac3 to 7f8c51e Compare July 23, 2025 02:26
@bigcat88 bigcat88 force-pushed the v3/nodes/nodes-part1-s-letter branch from a3c79c9 to 54bf034 Compare July 23, 2025 02:28
@bigcat88
Copy link
Contributor Author

rebased, tested, addressed the review - all is good

@Kosinkadink Kosinkadink merged commit 941dea9 into comfyanonymous:v3-definition Jul 23, 2025
2 checks passed
@bigcat88 bigcat88 deleted the v3/nodes/nodes-part1-s-letter branch July 23, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants