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

Method __init__

diffusers/examples/community/gluegen.py:30–56  ·  view source on GitHub ↗
(self, num_tok, dim, dim_out, mult=2)

Source from the content-addressed store, hash-verified

28
29class TranslatorBase(nn.Module):
30 def __init__(self, num_tok, dim, dim_out, mult=2):
31 super().__init__()
32
33 self.dim_in = dim
34 self.dim_out = dim_out
35
36 self.net_tok = nn.Sequential(
37 nn.Linear(num_tok, int(num_tok * mult)),
38 nn.LayerNorm(int(num_tok * mult)),
39 nn.GELU(),
40 nn.Linear(int(num_tok * mult), int(num_tok * mult)),
41 nn.LayerNorm(int(num_tok * mult)),
42 nn.GELU(),
43 nn.Linear(int(num_tok * mult), num_tok),
44 nn.LayerNorm(num_tok),
45 )
46
47 self.net_sen = nn.Sequential(
48 nn.Linear(dim, int(dim * mult)),
49 nn.LayerNorm(int(dim * mult)),
50 nn.GELU(),
51 nn.Linear(int(dim * mult), int(dim * mult)),
52 nn.LayerNorm(int(dim * mult)),
53 nn.GELU(),
54 nn.Linear(int(dim * mult), dim_out),
55 nn.LayerNorm(dim_out),
56 )
57
58 def forward(self, x):
59 if self.dim_in == self.dim_out:

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected