Skip to content

Commit

Permalink
Compel: Enable truncation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bghira committed Jul 30, 2023
1 parent 15dea91 commit c77db5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def __call__(self, **args):
user_config = args.get("user_config", None)
del args["user_config"] # This doesn't get passed to Diffusers.
logging.debug(f'Args (minus user_config) for SDXL refiner: {args}')
# Currently, it seems like the refiner's prompt weighting is broken.
# We are disabling it by default.
if user_config is not None and user_config.get("refiner_prompt_weighting", True) and config.enable_compel():
logging.info(f'Using SDXL prompt weighting.')
# SDXL, when using prompt embeds, must be instructed to only generate 1 image per prompt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, pipeline, device, use_second_encoder_only: bool = False):
self.pipeline.text_encoder,
self.pipeline.text_encoder_2
],
truncate_long_prompts=True,
truncate_long_prompts=False,
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
requires_pooled=[
False, # CLIP-L does not produce pooled embeds.
Expand All @@ -38,7 +38,7 @@ def __init__(self, pipeline, device, use_second_encoder_only: bool = False):
self.compel = Compel(
tokenizer=self.pipeline.tokenizer_2,
text_encoder=self.pipeline.text_encoder_2,
truncate_long_prompts=True,
truncate_long_prompts=False,
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
requires_pooled=True
)
Expand Down

0 comments on commit c77db5e

Please sign in to comment.