Fix custom model loader token_type_ids compatibility
Browse files
__pycache__/modeling_type_predictor.cpython-312.pyc
ADDED
|
Binary file (6.34 kB). View file
|
|
|
modeling_type_predictor.py
CHANGED
|
@@ -55,7 +55,10 @@ class NeoAraBERTTypePredictor(nn.Module):
|
|
| 55 |
self.dropout = nn.Dropout(float(dropout))
|
| 56 |
self.classifier = nn.Linear(self.hidden_size, int(num_labels))
|
| 57 |
|
| 58 |
-
def forward(self, input_ids=None, attention_mask=None, labels=None):
|
|
|
|
|
|
|
|
|
|
| 59 |
outputs = self.encoder(input_ids=input_ids, attention_mask=attention_mask)
|
| 60 |
hidden = outputs.last_hidden_state if hasattr(outputs, "last_hidden_state") else outputs[0]
|
| 61 |
logits = self.classifier(self.dropout(hidden[:, 0, :]))
|
|
|
|
| 55 |
self.dropout = nn.Dropout(float(dropout))
|
| 56 |
self.classifier = nn.Linear(self.hidden_size, int(num_labels))
|
| 57 |
|
| 58 |
+
def forward(self, input_ids=None, attention_mask=None, token_type_ids=None, labels=None, **kwargs):
|
| 59 |
+
# NeoAraBERT was trained here with input_ids and attention_mask only.
|
| 60 |
+
# Accept token_type_ids/extra tokenizer keys so callers can pass
|
| 61 |
+
# tokenizer(..., return_tensors="pt") directly.
|
| 62 |
outputs = self.encoder(input_ids=input_ids, attention_mask=attention_mask)
|
| 63 |
hidden = outputs.last_hidden_state if hasattr(outputs, "last_hidden_state") else outputs[0]
|
| 64 |
logits = self.classifier(self.dropout(hidden[:, 0, :]))
|
release_manifest.json
CHANGED
|
@@ -3,6 +3,10 @@
|
|
| 3 |
"sha256": "930dd95e0feefb5e1ff497f2c60930b86f3eb318179851a1ffd7f61d48b4d780",
|
| 4 |
"bytes": 13809
|
| 5 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"checkpoint_summary.json": {
|
| 7 |
"sha256": "eab687212a3bd05b0659ff7a255dc552b7d5bca87f75e5beffd318e5f384bf2b",
|
| 8 |
"bytes": 570
|
|
@@ -200,8 +204,8 @@
|
|
| 200 |
"bytes": 2994
|
| 201 |
},
|
| 202 |
"modeling_type_predictor.py": {
|
| 203 |
-
"sha256": "
|
| 204 |
-
"bytes":
|
| 205 |
},
|
| 206 |
"predictions/test_predictions.jsonl": {
|
| 207 |
"sha256": "fcf7973d1e70244cde5b8639296e0150392d176f3150037dadfe01ddeaa88a54",
|
|
|
|
| 3 |
"sha256": "930dd95e0feefb5e1ff497f2c60930b86f3eb318179851a1ffd7f61d48b4d780",
|
| 4 |
"bytes": 13809
|
| 5 |
},
|
| 6 |
+
"__pycache__/modeling_type_predictor.cpython-312.pyc": {
|
| 7 |
+
"sha256": "d3fccd58c9d18ff94f5949426ee4b0d66a1e2de8961410d178d44d19c3e73d8c",
|
| 8 |
+
"bytes": 6336
|
| 9 |
+
},
|
| 10 |
"checkpoint_summary.json": {
|
| 11 |
"sha256": "eab687212a3bd05b0659ff7a255dc552b7d5bca87f75e5beffd318e5f384bf2b",
|
| 12 |
"bytes": 570
|
|
|
|
| 204 |
"bytes": 2994
|
| 205 |
},
|
| 206 |
"modeling_type_predictor.py": {
|
| 207 |
+
"sha256": "26b66582aeebe272a0a6136c28ec4b215f4144854732fe48dd83d93d7b9315c6",
|
| 208 |
+
"bytes": 4554
|
| 209 |
},
|
| 210 |
"predictions/test_predictions.jsonl": {
|
| 211 |
"sha256": "fcf7973d1e70244cde5b8639296e0150392d176f3150037dadfe01ddeaa88a54",
|