MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / FluxMultiControlNetManager

Class FluxMultiControlNetManager

diffsynth/controlnets/controlnet_unit.py:68–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67
68class FluxMultiControlNetManager(MultiControlNetManager):
69 def __init__(self, controlnet_units=[]):
70 super().__init__(controlnet_units=controlnet_units)
71
72 def process_image(self, image, processor_id=None):
73 if processor_id is None:
74 processed_image = [processor(image) for processor in self.processors]
75 else:
76 processed_image = [self.processors[processor_id](image)]
77 return processed_image
78
79 def __call__(self, conditionings, **kwargs):
80 res_stack, single_res_stack = None, None
81 for processor, conditioning, model, scale in zip(self.processors, conditionings, self.models, self.scales):
82 res_stack_, single_res_stack_ = model(controlnet_conditioning=conditioning, processor_id=processor.processor_id, **kwargs)
83 res_stack_ = [res * scale for res in res_stack_]
84 single_res_stack_ = [res * scale for res in single_res_stack_]
85 if res_stack is None:
86 res_stack = res_stack_
87 single_res_stack = single_res_stack_
88 else:
89 res_stack = [i + j for i, j in zip(res_stack, res_stack_)]
90 single_res_stack = [i + j for i, j in zip(single_res_stack, single_res_stack_)]
91 return res_stack, single_res_stack

Callers 1

fetch_modelsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected