-
Notifications
You must be signed in to change notification settings - Fork 1
/
arguments.py
60 lines (47 loc) · 2.18 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
from typing import Optional
from dataclasses import dataclass, field
from transformers import TrainingArguments as OriginalTrainingArguments
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
"""
model_name_or_path: str = field(
default="bert-base-uncased",
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: Optional[str] = field(
default=None, metadata={"help": "Pretrained tokenizer name or path if not the same as model_name"}
)
cache_dir: Optional[str] = field(
default=".cache", metadata={"help": "Where do you want to store the pretrained models downloaded from s3"}
)
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
task_name: str = field(default="haafor", metadata={"help": "The name of the task"})
data_dir: str = field(default="data_in", metadata={"help": "Should contain the data files for the task."})
max_seq_length: int = field(
default=512,
metadata={
"help": "The maximum total input sequence length after tokenization. Sequences longer "
"than this will be truncated, sequences shorter will be padded."
},
)
overwrite_cache: bool = field(
default=False, metadata={"help": "Overwrite the cached training and evaluation sets"}
)
dynamic_doc_masking: bool = field(default=False, metadata={"help": "Dynamic doc id masking"})
@dataclass
class TrainingArguments(OriginalTrainingArguments):
output_dir: str = field(
default="data_out",
metadata={"help": "The output directory where the model predictions and checkpoints will be written."}
)
logging_dir: Optional[str] = field(default="data_out", metadata={"help": "Tensorboard log dir."})
ensemble: bool = field(default=False, metadata={"help": "Ensemble result"})