Create configuration.py
Browse files- configuration.py +27 -0
configuration.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import PretrainedConfig
|
2 |
+
|
3 |
+
class AlbertLSTMConfig(PretrainedConfig):
|
4 |
+
model_type = "albertLSTMForSequenceClassification"
|
5 |
+
|
6 |
+
def __init__(self,
|
7 |
+
num_classes=2,
|
8 |
+
embed_dim=768,
|
9 |
+
num_layers=12,
|
10 |
+
hidden_dim_lstm=256, # New parameter for LSTM
|
11 |
+
dropout_rate=0.1,
|
12 |
+
**kwargs):
|
13 |
+
super().__init__(**kwargs)
|
14 |
+
self.num_classes = num_classes
|
15 |
+
self.embed_dim = embed_dim
|
16 |
+
self.num_layers = num_layers
|
17 |
+
self.hidden_dim_lstm = hidden_dim_lstm # Assign LSTM hidden dimension
|
18 |
+
self.dropout_rate = dropout_rate
|
19 |
+
self.id2label = {
|
20 |
+
0: "fake",
|
21 |
+
1: "true",
|
22 |
+
}
|
23 |
+
self.label2id = {
|
24 |
+
"fake": 0,
|
25 |
+
"true": 1,
|
26 |
+
}
|
27 |
+
|