Update model.py
Browse files
model.py
CHANGED
@@ -8,12 +8,12 @@ class BERTBaseUncased(nn.Module):
|
|
8 |
super(BERTBaseUncased, self).__init__()
|
9 |
self.bert = transformers.BertModel.from_pretrained(config.BERT_PATH)
|
10 |
|
11 |
-
self.bert_drop = nn.Dropout(0.3)
|
12 |
|
13 |
-
self.out = nn.Linear(768, 3)
|
14 |
-
# self.out = nn.Linear(256, 3)
|
15 |
|
16 |
-
nn.init.xavier_uniform_(self.out.weight)
|
17 |
print("Model")
|
18 |
|
19 |
def forward(self, ids, mask, token_type_ids):
|
@@ -22,9 +22,9 @@ class BERTBaseUncased(nn.Module):
|
|
22 |
attention_mask=mask,
|
23 |
token_type_ids=token_type_ids
|
24 |
)
|
25 |
-
bo = self.bert_drop(o2)
|
26 |
-
# bo = self.tanh(self.fc(bo)) # to be commented if original
|
27 |
-
output = self.out(bo)
|
28 |
return output
|
29 |
|
30 |
def extract_features(self, ids, mask, token_type_ids):
|
|
|
8 |
super(BERTBaseUncased, self).__init__()
|
9 |
self.bert = transformers.BertModel.from_pretrained(config.BERT_PATH)
|
10 |
|
11 |
+
# self.bert_drop = nn.Dropout(0.3)
|
12 |
|
13 |
+
# self.out = nn.Linear(768, 3)
|
14 |
+
# # self.out = nn.Linear(256, 3)
|
15 |
|
16 |
+
# nn.init.xavier_uniform_(self.out.weight)
|
17 |
print("Model")
|
18 |
|
19 |
def forward(self, ids, mask, token_type_ids):
|
|
|
22 |
attention_mask=mask,
|
23 |
token_type_ids=token_type_ids
|
24 |
)
|
25 |
+
# bo = self.bert_drop(o2)
|
26 |
+
# # bo = self.tanh(self.fc(bo)) # to be commented if original
|
27 |
+
# output = self.out(bo)
|
28 |
return output
|
29 |
|
30 |
def extract_features(self, ids, mask, token_type_ids):
|