MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_down_block

Function get_down_block

diffusers/src/diffusers/models/unets/unet_3d_blocks.py:82–171  ·  view source on GitHub ↗
(
    down_block_type: str,
    num_layers: int,
    in_channels: int,
    out_channels: int,
    temb_channels: int,
    add_downsample: bool,
    resnet_eps: float,
    resnet_act_fn: str,
    num_attention_heads: int,
    resnet_groups: Optional[int] = None,
    cross_attention_dim: Optional[int] = None,
    downsample_padding: Optional[int] = None,
    dual_cross_attention: bool = False,
    use_linear_projection: bool = True,
    only_cross_attention: bool = False,
    upcast_attention: bool = False,
    resnet_time_scale_shift: str = "default",
    temporal_num_attention_heads: int = 8,
    temporal_max_seq_length: int = 32,
    transformer_layers_per_block: Union[int, Tuple[int]] = 1,
    temporal_transformer_layers_per_block: Union[int, Tuple[int]] = 1,
    dropout: float = 0.0,
)

Source from the content-addressed store, hash-verified

80
81
82def get_down_block(
83 down_block_type: str,
84 num_layers: int,
85 in_channels: int,
86 out_channels: int,
87 temb_channels: int,
88 add_downsample: bool,
89 resnet_eps: float,
90 resnet_act_fn: str,
91 num_attention_heads: int,
92 resnet_groups: Optional[int] = None,
93 cross_attention_dim: Optional[int] = None,
94 downsample_padding: Optional[int] = None,
95 dual_cross_attention: bool = False,
96 use_linear_projection: bool = True,
97 only_cross_attention: bool = False,
98 upcast_attention: bool = False,
99 resnet_time_scale_shift: str = "default",
100 temporal_num_attention_heads: int = 8,
101 temporal_max_seq_length: int = 32,
102 transformer_layers_per_block: Union[int, Tuple[int]] = 1,
103 temporal_transformer_layers_per_block: Union[int, Tuple[int]] = 1,
104 dropout: float = 0.0,
105) -> Union[
106 "DownBlock3D",
107 "CrossAttnDownBlock3D",
108 "DownBlockSpatioTemporal",
109 "CrossAttnDownBlockSpatioTemporal",
110]:
111 if down_block_type == "DownBlock3D":
112 return DownBlock3D(
113 num_layers=num_layers,
114 in_channels=in_channels,
115 out_channels=out_channels,
116 temb_channels=temb_channels,
117 add_downsample=add_downsample,
118 resnet_eps=resnet_eps,
119 resnet_act_fn=resnet_act_fn,
120 resnet_groups=resnet_groups,
121 downsample_padding=downsample_padding,
122 resnet_time_scale_shift=resnet_time_scale_shift,
123 dropout=dropout,
124 )
125 elif down_block_type == "CrossAttnDownBlock3D":
126 if cross_attention_dim is None:
127 raise ValueError("cross_attention_dim must be specified for CrossAttnDownBlock3D")
128 return CrossAttnDownBlock3D(
129 num_layers=num_layers,
130 in_channels=in_channels,
131 out_channels=out_channels,
132 temb_channels=temb_channels,
133 add_downsample=add_downsample,
134 resnet_eps=resnet_eps,
135 resnet_act_fn=resnet_act_fn,
136 resnet_groups=resnet_groups,
137 downsample_padding=downsample_padding,
138 cross_attention_dim=cross_attention_dim,
139 num_attention_heads=num_attention_heads,

Callers

nothing calls this directly

Calls 4

DownBlock3DClass · 0.85

Tested by

no test coverage detected