mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-10 18:05:16 +00:00
bddb02660c
* PixArt initial version * PixArt Diffusers convert logic * pos_emb and interpolation logic * Reduce duplicate code * Formatting * Use optimized attention * Edit empty token logic * Basic PixArt LoRA support * Fix aspect ratio logic * PixArtAlpha text encode with conds * Use same detection key logic for PixArt diffusers
25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
from nodes import MAX_RESOLUTION
|
|
|
|
class CLIPTextEncodePixArtAlpha:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {
|
|
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
|
"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
|
# "aspect_ratio": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
|
"text": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),
|
|
}}
|
|
|
|
RETURN_TYPES = ("CONDITIONING",)
|
|
FUNCTION = "encode"
|
|
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)
|
|
return (clip.encode_from_tokens_scheduled(tokens, add_dict={"width": width, "height": height}),)
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"CLIPTextEncodePixArtAlpha": CLIPTextEncodePixArtAlpha,
|
|
}
|