It's currently trying to load with the name as the key, which should never be the case.

This commit is contained in:
Brandon Rising 2024-02-27 10:02:54 -05:00 committed by Brandon
parent 4418c118db
commit 4d6047e05f
2 changed files with 8 additions and 4 deletions

View File

@ -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:

View File

@ -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