From cf4418b806af5f7f67e3ce5b6ee386360b410bbb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 26 Jul 2024 13:07:39 -0400 Subject: [PATCH] Don't treat Bert model like CLIP. Bert can accept up to 512 tokens so any prompt with more than 77 should just be passed to it as is instead of splitting it up like CLIP. --- comfy/text_encoders/hydit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/text_encoders/hydit.py b/comfy/text_encoders/hydit.py index fc1d3c75..ac0c893b 100644 --- a/comfy/text_encoders/hydit.py +++ b/comfy/text_encoders/hydit.py @@ -14,7 +14,7 @@ class HyditBertModel(sd1_clip.SDClipModel): class HyditBertTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "hydit_clip_tokenizer") - super().__init__(tokenizer_path, pad_with_end=False, embedding_size=1024, embedding_key='chinese_roberta', tokenizer_class=BertTokenizer) + super().__init__(tokenizer_path, pad_with_end=False, embedding_size=1024, embedding_key='chinese_roberta', tokenizer_class=BertTokenizer, pad_to_max_length=False, max_length=512, min_length=77) class MT5XLModel(sd1_clip.SDClipModel):