Skip to content

Commit

Permalink
Don't treat Bert model like CLIP.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
comfyanonymous committed Jul 26, 2024
1 parent 6225a78 commit cf4418b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion comfy/text_encoders/hydit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None):
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):
Expand Down

0 comments on commit cf4418b

Please sign in to comment.