Create configuration_textcnn.py
Browse files- configuration_textcnn.py +33 -0
configuration_textcnn.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers.configuration_utils import PretrainedConfig
|
2 |
+
|
3 |
+
|
4 |
+
class TextCNNConfig(PretrainedConfig):
|
5 |
+
def __init__(
|
6 |
+
self,
|
7 |
+
vocab_size=30000,
|
8 |
+
embed_dim=300,
|
9 |
+
filter_sizes=[1,2,3,4,5],
|
10 |
+
num_filters=[128]*5,
|
11 |
+
dropout=0.5,
|
12 |
+
num_labels=2,
|
13 |
+
id2label={0:"standard", 1:"dialect"},
|
14 |
+
label2id={"standard":0, "dialect":1},
|
15 |
+
bos_token_id=0,
|
16 |
+
eos_token_id=1,
|
17 |
+
pad_token_id=3,
|
18 |
+
**kwargs,
|
19 |
+
):
|
20 |
+
super().__init__(
|
21 |
+
num_labels=num_labels,
|
22 |
+
id2label=id2label,
|
23 |
+
label2id=label2id,
|
24 |
+
bos_token_id=bos_token_id,
|
25 |
+
eos_token_id=eos_token_id,
|
26 |
+
pad_token_id=pad_token_id,
|
27 |
+
**kwargs,
|
28 |
+
)
|
29 |
+
self.vocab_size = vocab_size
|
30 |
+
self.embed_dim = embed_dim
|
31 |
+
self.filter_sizes = filter_sizes
|
32 |
+
self.num_filters = num_filters
|
33 |
+
self.dropout = dropout
|