Skip to content

Commit 8f1afc0

Browse files
committed
Move SchedulerInvocation to a new file. No functional changes.
1 parent 854bca6 commit 8f1afc0

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

invokeai/app/invocations/latent.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
Input,
2525
InputField,
2626
LatentsField,
27-
OutputField,
2827
UIType,
2928
)
3029
from invokeai.app.invocations.ip_adapter import IPAdapterField
@@ -56,38 +55,13 @@
5655
)
5756
from ...backend.stable_diffusion.schedulers import SCHEDULER_MAP
5857
from ...backend.util.devices import TorchDevice
59-
from .baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output
58+
from .baseinvocation import BaseInvocation, invocation
6059
from .controlnet_image_processors import ControlField
6160
from .model import ModelIdentifierField, UNetField
6261

6362
DEFAULT_PRECISION = TorchDevice.choose_torch_dtype()
6463

6564

66-
@invocation_output("scheduler_output")
67-
class SchedulerOutput(BaseInvocationOutput):
68-
scheduler: SCHEDULER_NAME_VALUES = OutputField(description=FieldDescriptions.scheduler, ui_type=UIType.Scheduler)
69-
70-
71-
@invocation(
72-
"scheduler",
73-
title="Scheduler",
74-
tags=["scheduler"],
75-
category="latents",
76-
version="1.0.0",
77-
)
78-
class SchedulerInvocation(BaseInvocation):
79-
"""Selects a scheduler."""
80-
81-
scheduler: SCHEDULER_NAME_VALUES = InputField(
82-
default="euler",
83-
description=FieldDescriptions.scheduler,
84-
ui_type=UIType.Scheduler,
85-
)
86-
87-
def invoke(self, context: InvocationContext) -> SchedulerOutput:
88-
return SchedulerOutput(scheduler=self.scheduler)
89-
90-
9165
def get_scheduler(
9266
context: InvocationContext,
9367
scheduler_info: ModelIdentifierField,

invokeai/app/invocations/scheduler.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output
2+
from invokeai.app.invocations.constants import SCHEDULER_NAME_VALUES
3+
from invokeai.app.invocations.fields import (
4+
FieldDescriptions,
5+
InputField,
6+
OutputField,
7+
UIType,
8+
)
9+
from invokeai.app.services.shared.invocation_context import InvocationContext
10+
11+
12+
@invocation_output("scheduler_output")
13+
class SchedulerOutput(BaseInvocationOutput):
14+
scheduler: SCHEDULER_NAME_VALUES = OutputField(description=FieldDescriptions.scheduler, ui_type=UIType.Scheduler)
15+
16+
17+
@invocation(
18+
"scheduler",
19+
title="Scheduler",
20+
tags=["scheduler"],
21+
category="latents",
22+
version="1.0.0",
23+
)
24+
class SchedulerInvocation(BaseInvocation):
25+
"""Selects a scheduler."""
26+
27+
scheduler: SCHEDULER_NAME_VALUES = InputField(
28+
default="euler",
29+
description=FieldDescriptions.scheduler,
30+
ui_type=UIType.Scheduler,
31+
)
32+
33+
def invoke(self, context: InvocationContext) -> SchedulerOutput:
34+
return SchedulerOutput(scheduler=self.scheduler)

0 commit comments

Comments
 (0)