MonoHime commited on
Commit
bb282eb
1 Parent(s): 81412fa

Add model config

Browse files
Files changed (1) hide show
  1. custom_config.json +128 -0
custom_config.json ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset_reader": {
3
+ "class_name": "basic_classification_reader",
4
+ "x": "text",
5
+ "y": "sentiment",
6
+ "data_path": "/train/",
7
+ "train": "train.csv",
8
+ "valid": "valid.csv"
9
+ },
10
+ "dataset_iterator": {
11
+ "class_name": "basic_classification_iterator",
12
+ "seed": 42
13
+ },
14
+ "chainer": {
15
+ "in": [
16
+ "x"
17
+ ],
18
+ "in_y": [
19
+ "y"
20
+ ],
21
+ "pipe": [
22
+ {
23
+ "id": "classes_vocab",
24
+ "class_name": "simple_vocab",
25
+ "fit_on": [
26
+ "y"
27
+ ],
28
+ "save_path": "custom_bert/classes.dict",
29
+ "load_path": "custom_bert/classes.dict",
30
+ "in": "y",
31
+ "out": "y_ids"
32
+ },
33
+ {
34
+ "class_name": "transformers_bert_preprocessor",
35
+ "vocab_file": "vocab.txt",
36
+ "do_lower_case": false,
37
+ "max_seq_length": 512,
38
+ "in": ["x"],
39
+ "out": ["tokens", "subword_tokens", "subword_tok_ids", "startofword_markers", "attention_mask"]
40
+ },
41
+ {
42
+ "class_name": "transformers_bert_embedder",
43
+ "id": "my_embedder",
44
+ "bert_config_path": "config.json",
45
+ "truncate": false,
46
+ "load_path": "custom_bert",
47
+ "in": ["subword_tok_ids", "startofword_markers", "attention_mask"],
48
+ "out": ["word_emb", "subword_emb", "max_emb", "mean_emb", "pooler_output"]
49
+ },
50
+ {
51
+ "in": "y_ids",
52
+ "out": "y_onehot",
53
+ "class_name": "one_hotter",
54
+ "depth": "#classes_vocab.len",
55
+ "single_vector": true
56
+ },
57
+ {
58
+ "in": [
59
+ "word_emb"
60
+ ],
61
+ "in_y": [
62
+ "y_onehot"
63
+ ],
64
+ "out": [
65
+ "y_pred_probas"
66
+ ],
67
+ "main": true,
68
+ "class_name": "keras_classification_model",
69
+ "save_path": "custom_bert/model",
70
+ "load_path": "custom_bert/model",
71
+ "embedding_size": "#my_embedder.dim",
72
+ "n_classes": "#classes_vocab.len",
73
+ "kernel_sizes_cnn": [
74
+ 3,
75
+ 5,
76
+ 7
77
+ ],
78
+ "filters_cnn": 512,
79
+ "optimizer": "Adam",
80
+ "learning_rate": 0.01,
81
+ "learning_rate_decay": 0.1,
82
+ "loss": "categorical_crossentropy",
83
+ "last_layer_activation": "softmax",
84
+ "coef_reg_cnn": 1e-3,
85
+ "coef_reg_den": 1e-2,
86
+ "dropout_rate": 0.5,
87
+ "dense_size": 100,
88
+ "model_name": "cnn_model"
89
+ },
90
+ {
91
+ "in": "y_pred_probas",
92
+ "out": "y_pred_ids",
93
+ "class_name": "proba2labels",
94
+ "max_proba": true
95
+ },
96
+ {
97
+ "in": "y_pred_ids",
98
+ "out": "y_pred_labels",
99
+ "ref": "classes_vocab"
100
+ }
101
+ ],
102
+ "out": [
103
+ "y_pred_labels"
104
+ ]
105
+ },
106
+ "train": {
107
+ "epochs": 3,
108
+ "batch_size": 16,
109
+ "metrics": [
110
+ "accuracy",
111
+ "f1_macro",
112
+ "f1_weighted",
113
+ {
114
+ "name": "roc_auc",
115
+ "inputs": ["y_onehot", "y_pred_probas"]
116
+ }
117
+ ],
118
+ "validation_patience": 1,
119
+ "val_every_n_epochs": 1,
120
+ "log_every_n_epochs": 1,
121
+ "show_examples": false,
122
+ "evaluation_targets": [
123
+ "train",
124
+ "valid"
125
+ ],
126
+ "class_name": "nn_trainer"
127
+ }
128
+ }