MCPcopy Create free account
hub / github.com/AlayaLab/Hive / __init__

Method __init__

models/flowsep/diffusers/models/unet_2d_blocks.py:2115–2156  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        out_channels: int,
        dropout: float = 0.0,
        num_layers: int = 1,
        resnet_eps: float = 1e-6,
        resnet_time_scale_shift: str = "default",  # default, spatial
        resnet_act_fn: str = "swish",
        resnet_groups: int = 32,
        resnet_pre_norm: bool = True,
        output_scale_factor=1.0,
        add_upsample=True,
        temb_channels=None,
    )

Source from the content-addressed store, hash-verified

2113
2114class UpDecoderBlock2D(nn.Module):
2115 def __init__(
2116 self,
2117 in_channels: int,
2118 out_channels: int,
2119 dropout: float = 0.0,
2120 num_layers: int = 1,
2121 resnet_eps: float = 1e-6,
2122 resnet_time_scale_shift: str = "default", # default, spatial
2123 resnet_act_fn: str = "swish",
2124 resnet_groups: int = 32,
2125 resnet_pre_norm: bool = True,
2126 output_scale_factor=1.0,
2127 add_upsample=True,
2128 temb_channels=None,
2129 ):
2130 super().__init__()
2131 resnets = []
2132
2133 for i in range(num_layers):
2134 input_channels = in_channels if i == 0 else out_channels
2135
2136 resnets.append(
2137 ResnetBlock2D(
2138 in_channels=input_channels,
2139 out_channels=out_channels,
2140 temb_channels=temb_channels,
2141 eps=resnet_eps,
2142 groups=resnet_groups,
2143 dropout=dropout,
2144 time_embedding_norm=resnet_time_scale_shift,
2145 non_linearity=resnet_act_fn,
2146 output_scale_factor=output_scale_factor,
2147 pre_norm=resnet_pre_norm,
2148 )
2149 )
2150
2151 self.resnets = nn.ModuleList(resnets)
2152
2153 if add_upsample:
2154 self.upsamplers = nn.ModuleList([Upsample2D(out_channels, use_conv=True, out_channels=out_channels)])
2155 else:
2156 self.upsamplers = None
2157
2158 def forward(self, hidden_states, temb=None):
2159 for resnet in self.resnets:

Callers

nothing calls this directly

Calls 4

ResnetBlock2DClass · 0.85
Upsample2DClass · 0.85
__init__Method · 0.45
appendMethod · 0.45

Tested by

no test coverage detected