MCPcopy Create free account
hub / github.com/ace-step/ACE-Step / __init__

Method __init__

acestep/models/ace_step_transformer.py:156–190  ·  view source on GitHub ↗
(
        self,
        height=16,
        width=4096,
        patch_size=(16, 1),
        in_channels=8,
        embed_dim=1152,
        bias=True,
    )

Source from the content-addressed store, hash-verified

154 """2D Image to Patch Embedding"""
155
156 def __init__(
157 self,
158 height=16,
159 width=4096,
160 patch_size=(16, 1),
161 in_channels=8,
162 embed_dim=1152,
163 bias=True,
164 ):
165 super().__init__()
166 patch_size_h, patch_size_w = patch_size
167 self.early_conv_layers = nn.Sequential(
168 nn.Conv2d(
169 in_channels,
170 in_channels * 256,
171 kernel_size=patch_size,
172 stride=patch_size,
173 padding=0,
174 bias=bias,
175 ),
176 torch.nn.GroupNorm(
177 num_groups=32, num_channels=in_channels * 256, eps=1e-6, affine=True
178 ),
179 nn.Conv2d(
180 in_channels * 256,
181 embed_dim,
182 kernel_size=1,
183 stride=1,
184 padding=0,
185 bias=bias,
186 ),
187 )
188 self.patch_size = patch_size
189 self.height, self.width = height // patch_size_h, width // patch_size_w
190 self.base_size = self.width
191
192 def forward(self, latent):
193 # early convolutions, N x C x H x W -> N x 256 * sqrt(patch_size) x H/patch_size x W/patch_size

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected