Commit
·
f3cf192
1
Parent(s):
bea7d57
Upload BertForSequenceClassification
Browse files- config.json +6 -1
- modeling_bert.py +4 -1
- pytorch_model.bin +1 -1
config.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
{
|
| 2 |
"affine": true,
|
|
|
|
|
|
|
|
|
|
| 3 |
"attention_probs_dropout_prob": 0.1,
|
| 4 |
"auto_map": {
|
| 5 |
-
"AutoConfig": "configuration_bert.BertConfig"
|
|
|
|
| 6 |
},
|
| 7 |
"classifier_dropout": null,
|
| 8 |
"hidden_act": "gelu",
|
|
@@ -17,6 +21,7 @@
|
|
| 17 |
"num_hidden_layers": 12,
|
| 18 |
"pad_token_id": 0,
|
| 19 |
"position_embedding_type": "absolute",
|
|
|
|
| 20 |
"transformers_version": "4.33.3",
|
| 21 |
"type_vocab_size": 2,
|
| 22 |
"use_cache": true,
|
|
|
|
| 1 |
{
|
| 2 |
"affine": true,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
"attention_probs_dropout_prob": 0.1,
|
| 7 |
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_bert.BertConfig",
|
| 9 |
+
"AutoModelForSequenceClassification": "modeling_bert.BertForSequenceClassification"
|
| 10 |
},
|
| 11 |
"classifier_dropout": null,
|
| 12 |
"hidden_act": "gelu",
|
|
|
|
| 21 |
"num_hidden_layers": 12,
|
| 22 |
"pad_token_id": 0,
|
| 23 |
"position_embedding_type": "absolute",
|
| 24 |
+
"torch_dtype": "float32",
|
| 25 |
"transformers_version": "4.33.3",
|
| 26 |
"type_vocab_size": 2,
|
| 27 |
"use_cache": true,
|
modeling_bert.py
CHANGED
|
@@ -50,7 +50,10 @@ class BertPooler(nn.Module):
|
|
| 50 |
|
| 51 |
def __init__(self, config):
|
| 52 |
super().__init__()
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
self.activation = nn.Tanh()
|
| 55 |
|
| 56 |
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor) -> torch.Tensor:
|
|
|
|
| 50 |
|
| 51 |
def __init__(self, config):
|
| 52 |
super().__init__()
|
| 53 |
+
if config.affine:
|
| 54 |
+
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
|
| 55 |
+
else:
|
| 56 |
+
self.dense = nn.Identity()
|
| 57 |
self.activation = nn.Tanh()
|
| 58 |
|
| 59 |
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor) -> torch.Tensor:
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 438000689
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:994c6ca6ce911a444ebac151fbe611c63ba1d26c14438d690b2ea071958f419a
|
| 3 |
size 438000689
|