Fix Transformers FutureWarning (#5140)

* Update sd1_clip.py

Fix Transformers FutureWarning

* Update sd1_clip.py

Fix comment
This commit is contained in:
svdc 2024-10-14 21:12:20 -03:00 committed by GitHub
parent 191a0d56b4
commit 95b7cf9bbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -405,7 +405,7 @@ class SDTokenizer:
def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l', tokenizer_class=CLIPTokenizer, has_start_token=True, pad_to_max_length=True, min_length=None, pad_token=None, tokenizer_data={}):
if tokenizer_path is None:
tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer")
self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path)
self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path, clean_up_tokenization_spaces=True) # Fix Transformers FutureWarning by explicitly setting clean_up_tokenization_spaces to True
self.max_length = max_length
self.min_length = min_length