| 349 | |
| 350 | |
| 351 | class MLPProj(torch.nn.Module): |
| 352 | |
| 353 | def __init__(self, in_dim, out_dim): |
| 354 | super().__init__() |
| 355 | |
| 356 | self.proj = torch.nn.Sequential( |
| 357 | torch.nn.LayerNorm(in_dim), torch.nn.Linear(in_dim, in_dim), |
| 358 | torch.nn.GELU(), torch.nn.Linear(in_dim, out_dim), |
| 359 | torch.nn.LayerNorm(out_dim)) |
| 360 | |
| 361 | def forward(self, image_embeds): |
| 362 | clip_extra_context_tokens = self.proj(image_embeds) |
| 363 | return clip_extra_context_tokens |
| 364 | |
| 365 | |
| 366 | class AudioProjModel(ModelMixin, ConfigMixin): |