Update model.py
Browse files
model.py
CHANGED
@@ -3,8 +3,8 @@ import torch.nn as nn
|
|
3 |
from transformers import BertModel
|
4 |
|
5 |
class HybridModel(nn.Module):
|
6 |
-
def
|
7 |
-
super(HybridModel, self).
|
8 |
self.bert = BertModel.from_pretrained("indobenchmark/indobert-base-p1")
|
9 |
self.lstm = nn.LSTM(768, 128, bidirectional=True, batch_first=True)
|
10 |
self.dropout = nn.Dropout(dropout)
|
@@ -15,4 +15,4 @@ class HybridModel(nn.Module):
|
|
15 |
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
|
16 |
lstm_out, _ = self.lstm(outputs.last_hidden_state)
|
17 |
x = self.dropout(lstm_out[:, -1, :])
|
18 |
-
return torch.sigmoid(self.classifier(x))
|
|
|
3 |
from transformers import BertModel
|
4 |
|
5 |
class HybridModel(nn.Module):
|
6 |
+
def __init__(self, dropout=0.3):
|
7 |
+
super(HybridModel, self).__init__()
|
8 |
self.bert = BertModel.from_pretrained("indobenchmark/indobert-base-p1")
|
9 |
self.lstm = nn.LSTM(768, 128, bidirectional=True, batch_first=True)
|
10 |
self.dropout = nn.Dropout(dropout)
|
|
|
15 |
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
|
16 |
lstm_out, _ = self.lstm(outputs.last_hidden_state)
|
17 |
x = self.dropout(lstm_out[:, -1, :])
|
18 |
+
return torch.sigmoid(self.classifier(x))
|