11import torch
22
3- class InstructPixToPixConditioning :
4- @classmethod
5- def INPUT_TYPES (s ):
6- return {"required" : {"positive" : ("CONDITIONING" , ),
7- "negative" : ("CONDITIONING" , ),
8- "vae" : ("VAE" , ),
9- "pixels" : ("IMAGE" , ),
10- }}
3+ from typing_extensions import override
4+ from comfy_api .latest import ComfyExtension , io
115
12- RETURN_TYPES = ("CONDITIONING" ,"CONDITIONING" ,"LATENT" )
13- RETURN_NAMES = ("positive" , "negative" , "latent" )
14- FUNCTION = "encode"
156
16- CATEGORY = "conditioning/instructpix2pix"
7+ class InstructPixToPixConditioning (io .ComfyNode ):
8+ @classmethod
9+ def define_schema (cls ):
10+ return io .Schema (
11+ node_id = "InstructPixToPixConditioning" ,
12+ category = "conditioning/instructpix2pix" ,
13+ inputs = [
14+ io .Conditioning .Input ("positive" ),
15+ io .Conditioning .Input ("negative" ),
16+ io .Vae .Input ("vae" ),
17+ io .Image .Input ("pixels" ),
18+ ],
19+ outputs = [
20+ io .Conditioning .Output (display_name = "positive" ),
21+ io .Conditioning .Output (display_name = "negative" ),
22+ io .Latent .Output (display_name = "latent" ),
23+ ],
24+ )
1725
18- def encode (self , positive , negative , pixels , vae ):
26+ @classmethod
27+ def execute (cls , positive , negative , pixels , vae ) -> io .NodeOutput :
1928 x = (pixels .shape [1 ] // 8 ) * 8
2029 y = (pixels .shape [2 ] // 8 ) * 8
2130
@@ -38,8 +47,17 @@ def encode(self, positive, negative, pixels, vae):
3847 n = [t [0 ], d ]
3948 c .append (n )
4049 out .append (c )
41- return (out [0 ], out [1 ], out_latent )
50+ return io .NodeOutput (out [0 ], out [1 ], out_latent )
51+
52+
53+ class InstructPix2PixExtension (ComfyExtension ):
54+ @override
55+ async def get_node_list (self ) -> list [type [io .ComfyNode ]]:
56+ return [
57+ InstructPixToPixConditioning ,
58+ ]
59+
60+
61+ async def comfy_entrypoint () -> InstructPix2PixExtension :
62+ return InstructPix2PixExtension ()
4263
43- NODE_CLASS_MAPPINGS = {
44- "InstructPixToPixConditioning" : InstructPixToPixConditioning ,
45- }
0 commit comments