Skip to content

Update better_combos.py #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions py/better_combos.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,36 @@ async def get_images(request):

return web.json_response(images)


class LoraLoaderWithImages(LoraLoader):
RETURN_TYPES = (*LoraLoader.RETURN_TYPES, "STRING",)
RETURN_NAMES = (*getattr(LoraLoader, "RETURN_NAMES",
LoraLoader.RETURN_TYPES), "example")
LoraLoader.RETURN_TYPES), "lora_name")

@classmethod
def INPUT_TYPES(s):
types = super().INPUT_TYPES()
# Add back the hidden prompt for compatibility
types["optional"] = {"prompt": ("STRING", {"hidden": True})}
return types

def load_lora(self, **kwargs):
prompt = kwargs.pop("prompt", "")
return (*super().load_lora(**kwargs), prompt)

# Get the lora_name from the input parameters
lora_name = kwargs["lora_name"]

# Create a clean set of arguments without the prompt
clean_kwargs = {
"model": kwargs.get("model"),
"clip": kwargs.get("clip"),
"lora_name": kwargs.get("lora_name"),
"strength_model": kwargs.get("strength_model"),
"strength_clip": kwargs.get("strength_clip")
}

# Get the base results (model, clip)
result = super().load_lora(**clean_kwargs)

# Return model, clip, and lora_name
return (*result, lora_name)

class CheckpointLoaderSimpleWithImages(CheckpointLoaderSimple):
RETURN_TYPES = (*CheckpointLoaderSimple.RETURN_TYPES, "STRING",)
Expand Down