-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.py
71 lines (67 loc) · 2.08 KB
/
args.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
def build_subparser(subparsers):
subparsers
parser_building = subparsers.add_parser("build")
parser_building.add_argument(
"-d",
"--dataset",
type=str,
default="WILDRECEIPT",
choices=["FUNSD", "SROIE", "CORD", "WILDRECEIPT", "XFUND"],
help="Selecting the dataset for your model's training.",
)
parser_building.add_argument(
"-n",
"--max_node",
type=int,
help="Max nodes per node (edges per node)",
default=6,
)
return parser_building
def train_subparser(subparsers):
parser_train = subparsers.add_parser("train")
parser_train.add_argument(
"-d",
"--dataset",
type=str,
default="CORD",
choices=["FUNSD", "SROIE", "CORD", "WILDRECEIPT", "XFUND"],
help="Selecting the dataset for your model's training.",
)
parser_train.add_argument(
"-p",
"--path",
type=str,
default="data/",
help="Selecting the dataset path for the model's training.",
)
parser_train.add_argument(
"-hs", "--hidden_size", type=int, default=32, help="GCN hidden size."
)
parser_train.add_argument(
"-hl",
"--hidden_layers",
type=int,
default=20,
help="Number of GCN hidden Layers.",
)
parser_train.add_argument(
"-lr", "--learning_rate", type=float, default=0.01, help="The learning rate."
)
parser_train.add_argument(
"-e", "--epochs", type=int, default=200, help="The number of epochs."
)
return subparsers # Return the subparsers object for further use
def train_embedding_subparser(subparsers):
parser_train = subparsers.add_parser("embed")
parser_train.add_argument(
"-d",
"--dataset",
type=str,
default="CORD",
choices=["FUNSD", "SROIE", "CORD", "WILDRECEIPT", "XFUND"],
help="Selecting the dataset for your model's training.",
)
parser_train.add_argument(
"-e", "--epochs", type=int, default=200, help="The number of epochs."
)
return subparsers