diff --git a/comfy_extras/nodes_clip_sdxl.py b/comfy_extras/nodes_clip_sdxl.py index 55d372e16..dcf8859fa 100644 --- a/comfy_extras/nodes_clip_sdxl.py +++ b/comfy_extras/nodes_clip_sdxl.py @@ -1,26 +1,22 @@ import torch from nodes import MAX_RESOLUTION -from comfy.parse_choice import translate_choices class CLIPTextEncodeSDXLRefiner: @classmethod def INPUT_TYPES(s): return {"required": { - "clip": ("CLIP", ), "ascore": ("FLOAT", {"default": 6.0, "min": 0.0, "max": 1000.0, "step": 0.01}), "width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), "height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), - "text": ("STRING", {"multiline": True}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + "text": ("STRING", {"multiline": True}), "clip": ("CLIP", ), }} RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" CATEGORY = "advanced/conditioning" - def encode(self, clip, ascore, width, height, text, seed): - translated_prompt_text = translate_choices(text, seed) - tokens = clip.tokenize(translated_prompt_text) + def encode(self, clip, ascore, width, height, text): + tokens = clip.tokenize(text) cond, pooled = clip.encode_from_tokens(tokens, return_pooled=True) return ([[cond, {"pooled_output": pooled, "aesthetic_score": ascore, "width": width,"height": height}]], ) @@ -28,27 +24,23 @@ class CLIPTextEncodeSDXL: @classmethod def INPUT_TYPES(s): return {"required": { - "clip": ("CLIP", ), "width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), "height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), "crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}), "crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}), "target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), "target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}), - "text_g": ("STRING", {"multiline": True, "default": "CLIP_G"}), - "text_l": ("STRING", {"multiline": True, "default": "CLIP_L"}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + "text_g": ("STRING", {"multiline": True, "default": "CLIP_G"}), "clip": ("CLIP", ), + "text_l": ("STRING", {"multiline": True, "default": "CLIP_L"}), "clip": ("CLIP", ), }} RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" CATEGORY = "advanced/conditioning" - def encode(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l, seed): - translated_g = translate_choices(text_g, seed) - translated_l = translate_choices(text_l, seed) - tokens = clip.tokenize(translated_g) - tokens["l"] = clip.tokenize(translated_l)["l"] + def encode(self, clip, width, height, crop_w, crop_h, target_width, target_height, text_g, text_l): + tokens = clip.tokenize(text_g) + tokens["l"] = clip.tokenize(text_l)["l"] if len(tokens["l"]) != len(tokens["g"]): empty = clip.tokenize("") while len(tokens["l"]) < len(tokens["g"]): diff --git a/nodes.py b/nodes.py index 7292a4ca1..f6365cfe9 100644 --- a/nodes.py +++ b/nodes.py @@ -46,19 +46,14 @@ MAX_RESOLUTION=8192 class CLIPTextEncode: @classmethod def INPUT_TYPES(s): - return {"required": { - "text": ("STRING", {"multiline": True}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), - "clip": ("CLIP", ) - }} + return {"required": {"text": ("STRING", {"multiline": True}), "clip": ("CLIP", )}} RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" CATEGORY = "conditioning" - def encode(self, clip, seed, text): - translated_prompt_text = translate_choices(text, seed) - tokens = clip.tokenize(translated_prompt_text) + def encode(self, clip, text): + tokens = clip.tokenize(text) cond, pooled = clip.encode_from_tokens(tokens, return_pooled=True) return ([[cond, {"pooled_output": pooled}]], ) @@ -828,7 +823,6 @@ class GLIGENTextBoxApply: "clip": ("CLIP", ), "gligen_textbox_model": ("GLIGEN", ), "text": ("STRING", {"multiline": True}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), "width": ("INT", {"default": 64, "min": 8, "max": MAX_RESOLUTION, "step": 8}), "height": ("INT", {"default": 64, "min": 8, "max": MAX_RESOLUTION, "step": 8}), "x": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 8}), @@ -839,11 +833,9 @@ class GLIGENTextBoxApply: CATEGORY = "conditioning/gligen" - def append(self, conditioning_to, clip, gligen_textbox_model, text, seed, width, height, x, y): + def append(self, conditioning_to, clip, gligen_textbox_model, text, width, height, x, y): c = [] - translated_prompt_text = translate_choices(text, seed) - tokens = clip.tokenize(translated_prompt_text) - _, cond_pooled = clip.encode_from_tokens(tokens, return_pooled=True) + cond, cond_pooled = clip.encode_from_tokens(clip.tokenize(text), return_pooled=True) for t in conditioning_to: n = [t[0], t[1].copy()] position_params = [(cond_pooled, height // 8, width // 8, y // 8, x // 8)]