mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-14 05:41:06 +01:00
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.9, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, --use-pytorch-cross-attention, macos, 3.10, [self-hosted macOS], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, --use-pytorch-cross-attention, macos, 3.11, [self-hosted macOS], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, --use-pytorch-cross-attention, macos, 3.12, [self-hosted macOS], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, --use-pytorch-cross-attention, macos, 3.9, [self-hosted macOS], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, --use-pytorch-cross-attention, macos, 3.11, [self-hosted macOS], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.9) (push) Has been cancelled
74 lines
2.9 KiB
Python
74 lines
2.9 KiB
Python
from typing_extensions import override
|
|
|
|
import folder_paths
|
|
import comfy.sd
|
|
import comfy.model_management
|
|
from comfy_api.latest import ComfyExtension, io
|
|
|
|
|
|
class QuadrupleCLIPLoader(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls):
|
|
return io.Schema(
|
|
node_id="QuadrupleCLIPLoader",
|
|
category="advanced/loaders",
|
|
description="[Recipes]\n\nhidream: long clip-l, long clip-g, t5xxl, llama_8b_3.1_instruct",
|
|
inputs=[
|
|
io.Combo.Input("clip_name1", options=folder_paths.get_filename_list("text_encoders")),
|
|
io.Combo.Input("clip_name2", options=folder_paths.get_filename_list("text_encoders")),
|
|
io.Combo.Input("clip_name3", options=folder_paths.get_filename_list("text_encoders")),
|
|
io.Combo.Input("clip_name4", options=folder_paths.get_filename_list("text_encoders")),
|
|
],
|
|
outputs=[
|
|
io.Clip.Output(),
|
|
]
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, clip_name1, clip_name2, clip_name3, clip_name4):
|
|
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_path4 = folder_paths.get_full_path_or_raise("text_encoders", clip_name4)
|
|
clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2, clip_path3, clip_path4], embedding_directory=folder_paths.get_folder_paths("embeddings"))
|
|
return io.NodeOutput(clip)
|
|
|
|
class CLIPTextEncodeHiDream(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls):
|
|
return io.Schema(
|
|
node_id="CLIPTextEncodeHiDream",
|
|
category="advanced/conditioning",
|
|
inputs=[
|
|
io.Clip.Input("clip"),
|
|
io.String.Input("clip_l", multiline=True, dynamic_prompts=True),
|
|
io.String.Input("clip_g", multiline=True, dynamic_prompts=True),
|
|
io.String.Input("t5xxl", multiline=True, dynamic_prompts=True),
|
|
io.String.Input("llama", multiline=True, dynamic_prompts=True),
|
|
],
|
|
outputs=[
|
|
io.Conditioning.Output(),
|
|
]
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, clip, clip_l, clip_g, t5xxl, llama):
|
|
tokens = clip.tokenize(clip_g)
|
|
tokens["l"] = clip.tokenize(clip_l)["l"]
|
|
tokens["t5xxl"] = clip.tokenize(t5xxl)["t5xxl"]
|
|
tokens["llama"] = clip.tokenize(llama)["llama"]
|
|
return io.NodeOutput(clip.encode_from_tokens_scheduled(tokens))
|
|
|
|
|
|
class HiDreamExtension(ComfyExtension):
|
|
@override
|
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
|
return [
|
|
QuadrupleCLIPLoader,
|
|
CLIPTextEncodeHiDream,
|
|
]
|
|
|
|
|
|
async def comfy_entrypoint() -> HiDreamExtension:
|
|
return HiDreamExtension()
|