MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / FinalLayer

Class FinalLayer

models/ideogram4.py:243–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241
242
243class FinalLayer(nn.Module):
244 def __init__(self, model):
245 super().__init__()
246 self.final_layer = model.final_layer
247 self.model = [model]
248
249 def __getattr__(self, name):
250 return getattr(self.model[0], name)
251
252 def forward(self, inputs):
253 h, attn_mask, adaln_input, sizes, *freqs_cis = inputs
254 out = self.final_layer(h, adaln_input)
255 L_text, gh, gw = sizes
256 out = -self._tokens_to_img(out[:, L_text:], gh, gw)
257 return out
258
259
260class Wrapper(nn.Module):

Callers 1

to_layersMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected