From 4d6047e05f6ae5fb0c583554c993112b58d799d7 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Tue, 27 Feb 2024 10:02:54 -0500 Subject: [PATCH] It's currently trying to load with the name as the key, which should never be the case. --- invokeai/app/invocations/compel.py | 4 +++- invokeai/app/util/ti_utils.py | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/invokeai/app/invocations/compel.py b/invokeai/app/invocations/compel.py index 50f5322513..d62fcd4ac6 100644 --- a/invokeai/app/invocations/compel.py +++ b/invokeai/app/invocations/compel.py @@ -86,7 +86,9 @@ class CompelInvocation(BaseInvocation): for trigger in extract_ti_triggers_from_prompt(self.prompt): name = trigger[1:-1] try: - loaded_model = context.models.load(key=name).model + loaded_model = context.models.load_by_attrs( + model_name=name, base_model=text_encoder_info.config.base, model_type=ModelType.TextualInversion + ).model assert isinstance(loaded_model, TextualInversionModelRaw) ti_list.append((name, loaded_model)) except UnknownModelException: diff --git a/invokeai/app/util/ti_utils.py b/invokeai/app/util/ti_utils.py index a66a832b42..7e25d07a82 100644 --- a/invokeai/app/util/ti_utils.py +++ b/invokeai/app/util/ti_utils.py @@ -1,8 +1,10 @@ import re +from typing import List -def extract_ti_triggers_from_prompt(prompt: str) -> list[str]: - ti_triggers = [] + +def extract_ti_triggers_from_prompt(prompt: str) -> List[str]: + ti_triggers: List[str] = [] for trigger in re.findall(r"<[a-zA-Z0-9., _-]+>", prompt): - ti_triggers.append(trigger) + ti_triggers.append(str(trigger)) return ti_triggers