mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2025-12-10 14:34:25 +08:00
convert nodes_pixart.py to V3 schema (#10019)
This commit is contained in:
parent
bcfd80dd79
commit
ad5aef2d0c
@ -1,24 +1,38 @@
|
|||||||
from nodes import MAX_RESOLUTION
|
from typing_extensions import override
|
||||||
|
import nodes
|
||||||
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
class CLIPTextEncodePixArtAlpha:
|
class CLIPTextEncodePixArtAlpha(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def define_schema(cls):
|
||||||
return {"required": {
|
return io.Schema(
|
||||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
node_id="CLIPTextEncodePixArtAlpha",
|
||||||
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
category="advanced/conditioning",
|
||||||
|
description="Encodes text and sets the resolution conditioning for PixArt Alpha. Does not apply to PixArt Sigma.",
|
||||||
|
inputs=[
|
||||||
|
io.Int.Input("width", default=1024, min=0, max=nodes.MAX_RESOLUTION),
|
||||||
|
io.Int.Input("height", default=1024, min=0, max=nodes.MAX_RESOLUTION),
|
||||||
# "aspect_ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
# "aspect_ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
||||||
"text": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),
|
io.String.Input("text", multiline=True, dynamic_prompts=True),
|
||||||
}}
|
io.Clip.Input("clip"),
|
||||||
|
],
|
||||||
|
outputs=[
|
||||||
|
io.Conditioning.Output(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
@classmethod
|
||||||
FUNCTION = "encode"
|
def execute(cls, clip, width, height, text):
|
||||||
CATEGORY = "advanced/conditioning"
|
|
||||||
DESCRIPTION = "Encodes text and sets the resolution conditioning for PixArt Alpha. Does not apply to PixArt Sigma."
|
|
||||||
|
|
||||||
def encode(self, clip, width, height, text):
|
|
||||||
tokens = clip.tokenize(text)
|
tokens = clip.tokenize(text)
|
||||||
return (clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}),)
|
return io.NodeOutput(clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}))
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
|
||||||
"CLIPTextEncodePixArtAlpha": CLIPTextEncodePixArtAlpha,
|
class PixArtExtension(ComfyExtension):
|
||||||
}
|
@override
|
||||||
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
|
return [
|
||||||
|
CLIPTextEncodePixArtAlpha,
|
||||||
|
]
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> PixArtExtension:
|
||||||
|
return PixArtExtension()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user