Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

convert nodes_lotus.py to V3 schema (#10057)

Alexander Piskuna1127b232d22
diff --git a/comfy_extras/nodes_lotus.py b/comfy_extras/nodes_lotus.py
index 739dbdd3d..9f62ba2bf 100644
--- a/comfy_extras/nodes_lotus.py
+++ b/comfy_extras/nodes_lotus.py
@@ -1,20 +1,22 @@
+from typing_extensions import override
+
import torch
import comfy.model_management as mm
+from comfy_api.latest import ComfyExtension, io
+
+
+class LotusConditioning(io.ComfyNode):
+ @classmethod
+ def define_schema(cls):
+ return io.Schema(
+ node_id="LotusConditioning",
+ category="conditioning/lotus",
+ inputs=[],
+ outputs=[io.Conditioning.Output(display_name="conditioning")],
+ )
-class LotusConditioning:
@classmethod
- def INPUT_TYPES(s):
- return {
- "required": {
- },
- }
-
- RETURN_TYPES = ("CONDITIONING",)
- RETURN_NAMES = ("conditioning",)
- FUNCTION = "conditioning"
- CATEGORY = "conditioning/lotus"
-
- def conditioning(self):
+ def execute(cls) -> io.NodeOutput:
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
#and getting parity with the reference implementation would otherwise require inference and 800mb of tensors
@@ -22,8 +24,16 @@ class LotusConditioning:
cond = [[prompt_embeds, {}]]
- return (cond,)
+ return io.NodeOutput(cond)
+
+
+class LotusExtension(ComfyExtension):
+ @override
+ async def get_node_list(self) -> list[type[io.ComfyNode]]:
+ return [
+ LotusConditioning,
+ ]
+
-NODE_CLASS_MAPPINGS = {
- "LotusConditioning" : LotusConditioning,
-}
+async def comfy_entrypoint() -> LotusExtension:
+ return LotusExtension()