-
Notifications
You must be signed in to change notification settings - Fork 0
/
arguments.py
141 lines (112 loc) · 3.56 KB
/
arguments.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
from curses import meta
from dataclasses import dataclass, field
from typing import List, Optional
import transformers
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
datasets: Optional[str] = field(
default=None,
metadata={"help": "Comma separated list of dataset names, for training."}
)
data_dir: Optional[str] = field(
default=None,
metadata={"help": "Path to data directory"}
)
batch_size: int = field(
default = 8,
metadata= {"help": "Batch size"}
)
n_fold: int = field(
default = 1,
metadata={"help": "Number folds of dataset"}
)
@dataclass
class TrainingArguments(transformers.TrainingArguments):
"""
Arguments for the Trainer.
"""
output_dir: str = field(
default='experiments',
metadata={"help": "The output directory where the results and model weights will be written."}
)
selector_lr: float = field(
default=5e-5,
metadata={"help": "Learning rate of selector"}
)
generator_lr: float = field(
default=5e-5,
metadata={"help": "Learning rate of generator"}
)
gradient_clip_val: float = field(
default=0.0,
metadata={"help":"Gradient clipping value"}
)
num_epoches : int = field(
default=5,
metadata={"help": "number pretrain epoches"}
)
seed: int = field(
default=1741,
metadata={"help": "seeding for reproductivity"}
)
weight_mle: float = field(
default=0.8,
metadata={"help": "weight of generating mle loss"}
)
weight_selector_loss: float = field(
default=0.5,
metadata={"help": "weight of selector loss"}
)
finetune_selector_encoder: bool = field(
default=True,
metadata={"help": "Fine-tune selector encoder or not"}
)
finetune_in_OT_generator: bool = field(
default=True,
metadata={"help": "Fine-tune generator encoder (in OT) or not"}
)
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
"""
model_name_or_path: Optional[str] = field(
default=None, metadata={"help": "Path to pretrained model or model identifier from huggingface.co/models"}
)
config_name: Optional[str] = field(
default=None, metadata={"help": "Pretrained config name or path if not the same as model_name"}
)
tokenizer_name_or_path: Optional[str] = field(
default=None, metadata={"help": "Pretrained tokenizer name or path if not the same as model_name"}
)
kg_weight: float = field(
default=0.5,
metadata={"help": "Probability of KG senentence in selector"}
)
n_align_sents: Optional[int] = field(
default=5,
metadata={"help": "Number align sentences"}
)
n_align_words: Optional[int] = field(
default=10,
metadata={"help": "Number align words"}
)
n_selected_sents: Optional[int] = field(
default=None,
metadata={"help": "Number selected sentences"}
)
n_selected_words: Optional[int] = field(
default=None,
metadata={"help": "Number selected words"}
)
output_max_length: Optional[int] = field(
default=64,
metadata={"help": "Max length of Output sequences"}
)
use_rnn: Optional[bool] = field(
default=False,
metadata={'help': "Use rnn to imporve sentence consequentive ability"}
)