SМ
Size: a a a
SМ
SМ
SМ
SМ
SМ
d
def forward(self, input_ids, attention_mask):
h, _ = self.bert(input_ids=input_ids,
attention_mask=attention_mask,
output_attentions=None)
h_max = torch.max(h[:, 1:], dim=1).values
h_avg = torch.mean(h[:, 1:], dim=1)
encoded = torch.cat([h_max, h_avg], dim=1)
logits = self.decoder(encoded).squeeze()
return logits
SМ
SМ
SМ
SМ
SМ
SМ
SМ
def forward(self, input_ids, attention_mask):
h, _ = self.bert(input_ids=input_ids,
attention_mask=attention_mask,
output_attentions=None)
h_max = torch.max(h[:, 1:], dim=1).values
h_avg = torch.mean(h[:, 1:], dim=1)
encoded = torch.cat([h_max, h_avg], dim=1)
logits = self.decoder(encoded).squeeze()
return logits
d
SМ
SМ
d
SМ