| 77 | |
| 78 | class TranslatorBaseNoLN(nn.Module): |
| 79 | def __init__(self, num_tok, dim, dim_out, mult=2): |
| 80 | super().__init__() |
| 81 | |
| 82 | self.dim_in = dim |
| 83 | self.dim_out = dim_out |
| 84 | |
| 85 | self.net_tok = nn.Sequential( |
| 86 | nn.Linear(num_tok, int(num_tok * mult)), |
| 87 | nn.GELU(), |
| 88 | nn.Linear(int(num_tok * mult), int(num_tok * mult)), |
| 89 | nn.GELU(), |
| 90 | nn.Linear(int(num_tok * mult), num_tok), |
| 91 | ) |
| 92 | |
| 93 | self.net_sen = nn.Sequential( |
| 94 | nn.Linear(dim, int(dim * mult)), |
| 95 | nn.GELU(), |
| 96 | nn.Linear(int(dim * mult), int(dim * mult)), |
| 97 | nn.GELU(), |
| 98 | nn.Linear(int(dim * mult), dim_out), |
| 99 | ) |
| 100 | |
| 101 | def forward(self, x): |
| 102 | if self.dim_in == self.dim_out: |