Run black for formatting, fix pylint errors, and change to warning.

This commit is contained in:
Hameer Abbasi
2023-08-06 11:10:44 +00:00
parent 41418c5531
commit 1b60d4683e
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
pooled = None
negative_embed = None
negative_pooled = None
if shared.opts.data['prompt_attention'] != 'Fixed attention':
if shared.opts.data['prompt_attention'] in {'Compel parser', 'Full parser'}:
prompt_embed, pooled, negative_embed, negative_pooled = prompt_parser_diffusers.compel_encode_prompt(model, prompt, negative_prompt, prompt_2, negative_prompt_2, is_refiner)
if 'prompt' in possible:
if hasattr(model, 'text_encoder') and 'prompt_embeds' in possible and prompt_embed is not None:
+5 -3
View File
@@ -9,10 +9,11 @@ import modules.prompt_parser as prompt_parser
def convert_to_compel(prompt: str):
if prompt is None:
return None
# TODO: 100 should be steps, but doesn't actually matter because we can't schedule yet
all_schedules = prompt_parser.get_learned_conditioning_prompt_schedules(
prompt, 100
)[0]
)[
0
]
output_list = prompt_parser.parse_prompt_attention(all_schedules[0][1])
converted_prompt = []
for subprompt, weight in output_list:
@@ -28,9 +29,10 @@ def convert_to_compel(prompt: str):
def compel_encode_prompt(pipeline: typing.Any, *args, **kwargs):
compel_encode_fn = COMPEL_ENCODE_FN_DICT.get(type(pipeline), None)
if compel_encode_fn is None:
raise TypeError(
shared.log.warning(
f"Compel encoding not yet supported for {type(pipeline).__name__}."
)
return (None,) * 4
return compel_encode_fn(pipeline, *args, **kwargs)