forked from boostcampaitech2/mrc-level2-nlp-02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharguments.py
167 lines (158 loc) · 5.17 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
"""
model_name_or_path: str = field(
default="klue/roberta-large",
metadata={
"help": "Path to pretrained model or model identifier from huggingface.co/models"
},
)
rt_model_name: str = field(
default="klue/bert-base",
metadata={
"help": "Path to pretrained model or model identifier from huggingface.co/models"
},
)
config_name: Optional[str] = field(
default="klue/roberta-large",
metadata={
"help": "Pretrained config name or path if not the s ame as model_name"
},
)
tokenizer_name: Optional[str] = field(
default=None,
metadata={
"help": "customized tokenizer path if not the same as model_name"
},
)
customized_tokenizer_flag: bool = field(
default=False,
metadata={"help": "Load customized roberta tokenizer"},
)
k_fold : int = field(
default=5,
metadata={"help": "K for K-fold validation"},
)
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
dataset_name: Optional[str] = field(
default="/opt/ml/data/train_dataset",
metadata={"help": "The name of the dataset to use."},
)
overwrite_cache: bool = field(
default=False,
metadata={"help": "Overwrite the cached training and evaluation sets"},
)
preprocessing_num_workers: Optional[int] = field(
default=2,
metadata={"help": "The number of processes to use for the preprocessing."},
)
max_seq_length: int = field(
default=384,
metadata={
"help": "The maximum total input sequence length after tokenization. Sequences longer "
"than this will be truncated, sequences shorter will be padded."
},
)
pad_to_max_length: bool = field(
default=True, #True
metadata={
"help": "Whether to pad all samples to `max_seq_length`. "
"If False, will pad the samples dynamically when batching to the maximum length in the batch (which can "
"be faster on GPU but will be slower on TPU)."
},
)
doc_stride: int = field(
default=128,
metadata={
"help": "When splitting up a long document into chunks, how much stride to take between chunks."
},
)
max_answer_length: int = field(
default=30,
metadata={
"help": "The maximum length of an answer that can be generated. This is needed because the start "
"and end predictions are not conditioned on one another."
},
)
eval_retrieval: str = field(
default="sparse",
metadata={
"help": "Choose which passage retrieval to be used.[sparse, elastic_sparse]."
},
)
num_clusters: int = field(
default=64, metadata={"help": "Define how many clusters to use for faiss."}
)
top_k_retrieval: int = field(
default=50,
metadata={
"help": "Define how many top-k passages to retrieve based on similarity."
},
)
score_ratio: float = field(
default=0,
metadata={
"help": "Define the score ratio."
},
)
train_retrieval: bool = field(
default=False,
metadata={"help": "Whether to train sparse/dense embedding (prepare for retrieval)."},
)
data_selected: str = field(
default="",
metadata={"help": "data to find added tokens, context/answers/question with '_' e.g.) context_answers"},
)
rtt_dataset_name:str = field(
default=None,
metadata={"help" : "input rtt data name with path"},
)
preprocessing_pattern:str = field(
default=None,
metadata={"help" : "preprocessing(e.g. 123)"},
)
add_special_tokens_flag:bool = field(
default=False,
metadata={"help": "add special tokens"},
)
add_special_tokens_query_flag:bool = field(
default=False,
metadata={"help": "add special tokens about question type"},
)
retrieve_pickle: str = field(
default='',
metadata={"help":"put a pickle file path for load"},
)
another_scheduler_flag :bool = field(
default=False,
metadata={"help": "create another scheduler"}
)
num_cycles :int = field(
default=1,
metadata={"help": "cycles for get_cosine_schedule_with_warmup"}
)
@dataclass
class LoggingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
wandb_name: Optional[str] = field(
default="model/roberta",
metadata={"help": "wandb name"},
)
dotenv_path: Optional[str] = field(
default='./wandb.env',
metadata={"help":'input your dotenv path'},
)
project_name: Optional[str] = field(
default="mrc_project_1",
metadata={"help": "project name"},
)