Upload folder using huggingface_hub
Browse files
modeling_phobert_aspect.py
CHANGED
|
@@ -40,10 +40,11 @@ class PhoBERTClassifier(PreTrainedModel):
|
|
| 40 |
|
| 41 |
self.post_init()
|
| 42 |
|
| 43 |
-
def forward(self, input_ids, attention_mask):
|
| 44 |
outputs = self.phobert(
|
| 45 |
input_ids=input_ids,
|
| 46 |
-
attention_mask=attention_mask
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
pooled = outputs.last_hidden_state[:, 0, :]
|
|
@@ -51,3 +52,4 @@ class PhoBERTClassifier(PreTrainedModel):
|
|
| 51 |
|
| 52 |
logits = [clf(pooled) for clf in self.classifiers]
|
| 53 |
return torch.stack(logits, dim=1)
|
|
|
|
|
|
| 40 |
|
| 41 |
self.post_init()
|
| 42 |
|
| 43 |
+
def forward(self, input_ids=None, attention_mask=None, token_type_ids=None,**kwargs):
|
| 44 |
outputs = self.phobert(
|
| 45 |
input_ids=input_ids,
|
| 46 |
+
attention_mask=attention_mask,
|
| 47 |
+
token_type_ids=token_type_ids
|
| 48 |
)
|
| 49 |
|
| 50 |
pooled = outputs.last_hidden_state[:, 0, :]
|
|
|
|
| 52 |
|
| 53 |
logits = [clf(pooled) for clf in self.classifiers]
|
| 54 |
return torch.stack(logits, dim=1)
|
| 55 |
+
|