mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 17:42:58 +08:00
convert nodes_lotus.py to V3 schema (#10057)
This commit is contained in:
parent
896f2e653c
commit
a1127b232d
@ -1,20 +1,22 @@
|
|||||||
|
from typing_extensions import override
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import comfy.model_management as mm
|
import comfy.model_management as mm
|
||||||
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
class LotusConditioning:
|
|
||||||
|
class LotusConditioning(io.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def define_schema(cls):
|
||||||
return {
|
return io.Schema(
|
||||||
"required": {
|
node_id="LotusConditioning",
|
||||||
},
|
category="conditioning/lotus",
|
||||||
}
|
inputs=[],
|
||||||
|
outputs=[io.Conditioning.Output(display_name="conditioning")],
|
||||||
|
)
|
||||||
|
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
@classmethod
|
||||||
RETURN_NAMES = ("conditioning",)
|
def execute(cls) -> io.NodeOutput:
|
||||||
FUNCTION = "conditioning"
|
|
||||||
CATEGORY = "conditioning/lotus"
|
|
||||||
|
|
||||||
def conditioning(self):
|
|
||||||
device = mm.get_torch_device()
|
device = mm.get_torch_device()
|
||||||
#lotus uses a frozen encoder and null conditioning, i'm just inlining the results of that operation since it doesn't change
|
#lotus uses a frozen encoder and null conditioning, i'm just inlining the results of that operation since it doesn't change
|
||||||
#and getting parity with the reference implementation would otherwise require inference and 800mb of tensors
|
#and getting parity with the reference implementation would otherwise require inference and 800mb of tensors
|
||||||
@ -22,8 +24,16 @@ class LotusConditioning:
|
|||||||
|
|
||||||
cond = [[prompt_embeds, {}]]
|
cond = [[prompt_embeds, {}]]
|
||||||
|
|
||||||
return (cond,)
|
return io.NodeOutput(cond)
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
|
||||||
"LotusConditioning" : LotusConditioning,
|
class LotusExtension(ComfyExtension):
|
||||||
}
|
@override
|
||||||
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||||
|
return [
|
||||||
|
LotusConditioning,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def comfy_entrypoint() -> LotusExtension:
|
||||||
|
return LotusExtension()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user