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

Class ControlNetConditioningLayer

diffsynth/models/sd_controlnet.py:6–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class ControlNetConditioningLayer(torch.nn.Module):
7 def __init__(self, channels = (3, 16, 32, 96, 256, 320)):
8 super().__init__()
9 self.blocks = torch.nn.ModuleList([])
10 self.blocks.append(torch.nn.Conv2d(channels[0], channels[1], kernel_size=3, padding=1))
11 self.blocks.append(torch.nn.SiLU())
12 for i in range(1, len(channels) - 2):
13 self.blocks.append(torch.nn.Conv2d(channels[i], channels[i], kernel_size=3, padding=1))
14 self.blocks.append(torch.nn.SiLU())
15 self.blocks.append(torch.nn.Conv2d(channels[i], channels[i+1], kernel_size=3, padding=1, stride=2))
16 self.blocks.append(torch.nn.SiLU())
17 self.blocks.append(torch.nn.Conv2d(channels[-2], channels[-1], kernel_size=3, padding=1))
18
19 def forward(self, conditioning):
20 for block in self.blocks:
21 conditioning = block(conditioning)
22 return conditioning
23
24
25class SDControlNet(torch.nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected