support for SD3: infinite prompt length, token counting

This commit is contained in:
AUTOMATIC1111
2024-06-26 23:22:00 +03:00
parent a8fba9af35
commit d686e73daa
6 changed files with 278 additions and 139 deletions

View File

@@ -325,7 +325,10 @@ class StableDiffusionModelHijack:
if self.clip is None:
return "-", "-"
_, token_count = self.clip.process_texts([text])
if hasattr(self.clip, 'get_token_count'):
token_count = self.clip.get_token_count(text)
else:
_, token_count = self.clip.process_texts([text])
return token_count, self.clip.get_target_prompt_token_count(token_count)