Skip to content

Commit cf4418b

Browse files
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.
1 parent 6225a78 commit cf4418b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

comfy/text_encoders/hydit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None):
1414
class HyditBertTokenizer(sd1_clip.SDTokenizer):
1515
def __init__(self, embedding_directory=None, tokenizer_data={}):
1616
tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "hydit_clip_tokenizer")
17-
super().__init__(tokenizer_path, pad_with_end=False, embedding_size=1024, embedding_key='chinese_roberta', tokenizer_class=BertTokenizer)
17+
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)
1818

1919

2020
class MT5XLModel(sd1_clip.SDClipModel):

0 commit comments

Comments
 (0)