From 66eef6d7d66e5e9a566c4f890c5ff360ecd5cc38 Mon Sep 17 00:00:00 2001 From: Michael Poutre Date: Thu, 24 Aug 2023 20:04:42 -0700 Subject: [PATCH] Remove KepAdvTextEncode node --- __init__.py | 2 -- nodes.py | 43 ------------------------------------------- 2 files changed, 45 deletions(-) diff --git a/__init__.py b/__init__.py index 89646da..84c3ded 100644 --- a/__init__.py +++ b/__init__.py @@ -1,11 +1,9 @@ from .nodes import ( - KepAdvTextEncode, BuildGif, SpecialClipLoader, ) NODE_CLASS_MAPPINGS = { - "Kep Adv Text Encode": KepAdvTextEncode, "Build Gif": BuildGif, "Special CLIP Loader": SpecialClipLoader, } diff --git a/nodes.py b/nodes.py index c086220..9245764 100644 --- a/nodes.py +++ b/nodes.py @@ -43,49 +43,6 @@ class SpecialClipLoader: return (clip,) -class KepAdvTextEncode: - @classmethod - def INPUT_TYPES(s): - return { - "required": { - "text": ("STRING", {"multiline": True}), - "clip": ("CLIP",), - "nudge_start": ("INT", {}), - "nudge_end": ("INT", {}), - "split_newlines": ("BOOL", {"default": True}), - } - } - - RETURN_TYPES = ("CONDITIONING",) - FUNCTION = "encode" - OUTPUT_IS_LIST = (True,) - CATEGORY = "conditioning" - - @staticmethod - def encode(clip, text, nudge_start, nudge_end, split_newlines): - ret = [] - if split_newlines: - prompts = text.split("\n") - else: - prompts = [text] - - for prompt in prompts: - if prompt.strip() == "": - continue - tokens = clip.tokenizer.tokenize_with_weights( - text, - return_word_ids=False, - nudge_start=nudge_start, - nudge_end=nudge_end, - ) - cond, pooled = clip.encode_from_tokens( - tokens, return_pooled=True, position_ids=[0] * 77 - ) - cond = [[cond, {"pooled_output": pooled}]] - ret.append(cond) - return (ret,) - - def tensor2img(tensor_img): i = 255.0 * tensor_img.cpu().numpy() i_np_arr = np.clip(i, 0, 255, out=i).astype(np.uint8, copy=False)