Skip to content

Commit

Permalink
refactor: explicit text_projection
Browse files Browse the repository at this point in the history
  • Loading branch information
R3gm committed Nov 30, 2024
1 parent e516157 commit 923bd52
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions stablepy/diffusers_vanilla/multi_emphasis_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,12 @@ def encode_with_transformers(self, tokens):

# sdxl no clip skip
def encode_with_transformers_xl(self, tokens):
outputs = self.text_encoder(input_ids=tokens, output_hidden_states=self.layer == "hidden")
outputs = self.text_encoder.text_model(input_ids=tokens, output_hidden_states=self.layer == "hidden")

pooled = None
if outputs[0].shape[-1] == 1280:
pooled = outputs[0]
pooled = outputs.pooler_output
pooled = self.text_encoder.text_projection(pooled)

if self.layer == "last":
z = outputs.last_hidden_state
Expand Down Expand Up @@ -475,7 +476,7 @@ def text_embeddings_equal_len(text_embedder, prompt, negative_prompt, get_pooled
else:
return all_embeddings


@torch.no_grad()
def long_prompts_with_weighting(pipe, prompt, negative_prompt, clip_skip=2, emphasis="Original", comma_padding_backtrack=20):
text_embedder = StableDiffusionLongPromptProcessor(
pipe,
Expand Down

0 comments on commit 923bd52

Please sign in to comment.