-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_arguments.py
More file actions
87 lines (73 loc) · 2.09 KB
/
parse_arguments.py
File metadata and controls
87 lines (73 loc) · 2.09 KB
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
import argparse
def parse_args():
parser = argparse.ArgumentParser(description="Main script for training and evaluating the classifiers.")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--local", action="store_true", help="Flag for running locally.")
# Add argument for loading a checkpoint
parser.add_argument(
"--checkpoint",
type=str,
help="Path to a checkpoint to be loaded. If not specified, the model will be trained from scratch.",
)
# dataset
parser.add_argument(
"-d",
"--dataset",
type=str,
default="ASVspoof2019LADataset_pair",
help="Dataset to be used. See common.DATASETS for available datasets.",
required=True,
)
# extractor
parser.add_argument(
"-e",
"--extractor",
type=str,
default="XLSR_300M",
help=f"Extractor to be used. See common.EXTRACTORS for available extractors.",
required=True,
)
# feature processor
feature_processors = ["Mean"]
parser.add_argument(
"-p",
"--processor",
"--pooling",
type=str,
help=f"Feature processor to be used. One of: {', '.join(feature_processors)}",
required=True,
)
# classifier
parser.add_argument(
"-c",
"--classifier",
type=str,
help=f"Classifier to be used. See common.CLASSIFIERS for available classifiers.",
required=True,
)
# augmentations
parser.add_argument(
"-a",
"--augment",
action="store_true",
help="Flag for whether to use augmentations during training. Does nothing during evaluation.",
)
# region Optional arguments
# training
parser.add_argument(
"-ep",
"--num_epochs",
type=int,
help="Number of epochs to train for.",
default=20,
)
# seed
parser.add_argument(
"--seed",
type=int,
help="Seed for reproducibility.",
default=42,
)
# endregion
args = parser.parse_args()
return args