def forward(self, text):
    x = self.pos_enc(self.emb(text)).transpose(1, 2)
    for (idx, layer) in enumerate(self.encoder):
        x = checkpoint(layer.forward, (x,), layer.parameters(), self.use_checkpoint)
    if (not hasattr(self, 'clip_proj')):
        return x
    else:
        return self.clip_proj(x[th.arange(x.shape[0]), :, text.argmax(dim=(- 1))].unsqueeze((- 1))).squeeze((- 1))
def forward(self, text):
    x = self.pos_enc(self.emb(text)).transpose(1, 2)
    for (idx, layer) in enumerate(self.encoder):
        x = checkpoint(layer.forward, (x,), layer.parameters(), self.use_checkpoint)
    if (not hasattr(self, 'clip_proj')):
        return x
    else:
        return self.clip_proj(x[th.arange(x.shape[0]), :, text.argmax(dim=(- 1))].unsqueeze((- 1))).squeeze((- 1))