Method
__init__
(
self,
in_channels,
hidden_size,
uncond_prob,
act_layer=nn.GELU(approximate="tanh"),
token_num=120,
)
Source from the content-addressed store, hash-verified
| 180 | """ |
| 181 | |
| 182 | def __init__( |
| 183 | self, |
| 184 | in_channels, |
| 185 | hidden_size, |
| 186 | uncond_prob, |
| 187 | act_layer=nn.GELU(approximate="tanh"), |
| 188 | token_num=120, |
| 189 | ): |
| 190 | super().__init__() |
| 191 | self.y_proj = Mlp( |
| 192 | in_features=in_channels, |
| 193 | hidden_features=hidden_size, |
| 194 | out_features=hidden_size, |
| 195 | act_layer=act_layer, |
| 196 | drop=0, |
| 197 | ) |
| 198 | self.register_buffer( |
| 199 | "y_embedding", |
| 200 | nn.Parameter(torch.randn(token_num, in_channels) / in_channels**0.5), |
| 201 | ) |
| 202 | self.uncond_prob = uncond_prob |
| 203 | |
| 204 | def token_drop(self, caption, force_drop_ids=None): |
| 205 | """ |
Callers
nothing calls this directly
Tested by
no test coverage detected