Make FluxControlLoRALoaderOutput.control_lora non-optional.

This commit is contained in:
Ryan Dick
2024-12-16 15:09:24 +00:00
committed by Kent Keirsey
parent 70811d0bd0
commit ac82f73dbe

View File

@@ -1,5 +1,3 @@
from typing import Optional
from invokeai.app.invocations.baseinvocation import (
BaseInvocation,
BaseInvocationOutput,
@@ -16,8 +14,8 @@ from invokeai.app.services.shared.invocation_context import InvocationContext
class FluxControlLoRALoaderOutput(BaseInvocationOutput):
"""Flux Control LoRA Loader Output"""
control_lora: Optional[ControlLoRAField] = OutputField(
title="Flux Control Lora", description="Control LoRAs to apply on model loading", default=None
control_lora: ControlLoRAField = OutputField(
title="Flux Control LoRA", description="Control LoRAs to apply on model loading", default=None
)
@@ -26,7 +24,7 @@ class FluxControlLoRALoaderOutput(BaseInvocationOutput):
title="Flux Control LoRA",
tags=["lora", "model", "flux"],
category="model",
version="1.1.0",
version="1.0.0",
classification=Classification.Prototype,
)
class FluxControlLoRALoaderInvocation(BaseInvocation):
@@ -35,9 +33,7 @@ class FluxControlLoRALoaderInvocation(BaseInvocation):
lora: ModelIdentifierField = InputField(
description=FieldDescriptions.control_lora_model, title="Control LoRA", ui_type=UIType.ControlLoRAModel
)
image: ImageField = InputField(
description="The image to encode.",
)
image: ImageField = InputField(description="The image to encode.")
def invoke(self, context: InvocationContext) -> FluxControlLoRALoaderOutput:
lora_key = self.lora.key
@@ -45,11 +41,10 @@ class FluxControlLoRALoaderInvocation(BaseInvocation):
if not context.models.exists(lora_key):
raise ValueError(f"Unknown lora: {lora_key}!")
output = FluxControlLoRALoaderOutput()
output.control_lora = ControlLoRAField(
lora=self.lora,
img=self.image,
weight=1,
return FluxControlLoRALoaderOutput(
control_lora=ControlLoRAField(
lora=self.lora,
img=self.image,
weight=1,
)
)
return output