-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit_parameter.py
96 lines (59 loc) · 4.39 KB
/
init_parameter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# coding=utf-8
from argparse import ArgumentParser
def init_model():
parser = ArgumentParser()
parser.add_argument("--data_dir", default='data', type=str,
help="The input data dir. Should contain the .csv files (or other data files) for the task.")
parser.add_argument("--name", default='name of the experiment', type=str)
parser.add_argument("--save_results_path", type=str, default='outputs', help="The path to save results.")
parser.add_argument("--pretrain_dir", default='pretrain_models', type=str,
help="The output directory where the model predictions and checkpoints will be written.")
parser.add_argument("--bert_model", default="./model/", type=str, help="The path for the pre-trained bert model.")
parser.add_argument("--max_seq_length", default=None, type=int,
help="The maximum total input sequence length after tokenization. Sequences longer "
"than this will be truncated, sequences shorter will be padded.")
parser.add_argument("--feat_dim", default=768, type=int, help="The feature dimension.")
parser.add_argument("--warmup_proportion", default=0.1, type=float)
parser.add_argument("--freeze_bert_parameters_pretrain", action="store_true",
help="Freeze the last parameters of BERT.")
parser.add_argument("--freeze_bert_parameters_EM", action="store_true", help="Freeze some parameters of BERT during EM.")
parser.add_argument("--save_model_pre", action="store_true", help="Save trained model.")
parser.add_argument("--save_model", action="store_true", help="Save trained model.")
parser.add_argument("--augment_data_simcse", action="store_true", help="data augment using simcse embedding ")
parser.add_argument("--augment_data", action="store_true", help="data augment using our method")
parser.add_argument("--pretrain", action="store_true", help="Pre-train the model with labeled data.")
parser.add_argument("--pseudo_label", action="store_true", help="add pseudo label loss")
parser.add_argument("--dataset", default=None, type=str, required=True,
help="The name of the dataset to train selected.")
parser.add_argument("--known_cls_ratio", default=0.75, type=float, required=True,
help="The number of known classes.")
parser.add_argument("--cluster_num_factor", default=1.0, type=float, required=True,
help="The factor (magnification) of the number of clusters K.")
parser.add_argument('--k', type=int, default=1, help="topk in data augment")
parser.add_argument('--seed', type=int, default=0, help="Random seed for initialization. we choose 42 52 62")
parser.add_argument("--method", type=str, default='DeepAligned', help="Which method to use.")
parser.add_argument("--labeled_ratio", default=0.1, type=float,
help="The ratio of labeled samples in the training set.")
parser.add_argument("--gpu_id", type=str, default='0', help="Select the GPU id.")
parser.add_argument("--train_batch_size", default=512, type=int,
help="Batch size for training.")
parser.add_argument("--eval_batch_size", default=64, type=int,
help="Batch size for evaluation.")
parser.add_argument("--wait_patient_pre", default=5, type=int,
help="Patient steps for Early Stop in pretrain.")
parser.add_argument("--wait_patient", default=20, type=int,
help="Patient steps for Early Stop.")
parser.add_argument("--num_pretrain_epochs", default=100, type=float,
help="The pre-training epochs.")
parser.add_argument("--num_train_epochs", default=100, type=float,
help="The training epochs.")
parser.add_argument("--lr_pre", default=5e-5, type=float,
help="The learning rate for pre-training.")
parser.add_argument("--lr", default=1e-5, type=float,
help="The learning rate for training.")
parser.add_argument("--t", default=0.1, type=float,
help="The temperature of infoNCE loss")
parser.add_argument("--beta", default=0.6, type=float,
help="The rate for our loss")
parser.add_argument("--load_mtp", type=str, help="The path for the mtp2step model.")
return parser