-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
177 lines (172 loc) · 5.21 KB
/
__main__.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
168
169
170
171
172
173
174
175
176
177
import argparse
import datetime
from venus.common.configuration import Config
from venus.verification.venus import Venus
def boolean_string(s):
assert s in ['False', 'True']
return s == 'True'
def main():
parser = argparse.ArgumentParser(description="Venus Example")
parser.add_argument(
"--spec",
type=str,
required=True,
help="Vnnlib file of the specification."
)
parser.add_argument(
"--benchmark",
type=str,
required=False,
help="Benchmark."
)
parser.add_argument(
"--net",
type=str,
required=True,
help="Path to the neural network in ONNX."
)
parser.add_argument(
"--stability_ratio_cutoff",
default=None,
type=float,
help="Cutoff value of the stable ratio during the splitting procedure. Default value is 0.5."
)
parser.add_argument(
"--split_proc_num",
default=None,
type=int,
help="Determines the number of splitting processes = 2^splitters. Default value is 0. -1 for None."
)
parser.add_argument(
"--ver_proc_num",
default=None,
type=int,
help="Number of verification processes. Default value is 1."
)
parser.add_argument(
"--intra_dep_constrs",
default=None,
type=boolean_string,
help="Whether to include offline intra dependency contrainsts (before starting the solver) or not. Default value is True."
)
parser.add_argument(
"--inter_dep_constrs",
default=None,
type=boolean_string,
help="Whether to include offline inter dependency contrainsts (before starting the solver) or not. Default value is True."
)
parser.add_argument(
"--intra_dep_cuts",
default=None,
type=boolean_string,
help="Whether to include online intra dependency cuts (through solver callbacks) or not. Default value is True."
)
parser.add_argument(
"--inter_dep_cuts",
default=None,
type=boolean_string,
help="Whether to include online inter dependency cuts (through solver callbacks) or not. Default value is True."
)
parser.add_argument(
"--ideal_cuts",
default=None,
type=boolean_string,
help="Whether to include online ideal cuts (through solver callbacks) or not. Default value is True."
)
parser.add_argument(
"--split_strategy",
choices=["node","nodeonce","input","inputnode","inputnodeonce","nodeinput","nodeonceinput","inputnodealt","inputnodeoncealt","none"],
default=None,
help="Strategies for diving the verification problem"
)
parser.add_argument(
"--monitor_split",
default=None,
type=boolean_string,
help="If true branching is initiated only after the <branching_threshold> of MILP nodes is reached"
)
parser.add_argument(
"--branching_depth",
default=None,
type=int,
help="Maximum branching depth"
)
parser.add_argument(
"--branching_threshold",
default=None,
type=int,
help="MILP node thresholf before inititing branching"
)
parser.add_argument(
"--timeout",
default=None,
type=float,
help="Timeout in seconds. Default value is 3600."
)
parser.add_argument(
"--logfile",
default="venus_log.txt",
type=str,
help="Path to logging file."
)
parser.add_argument(
"--sumfile",
default="venus_summary.txt",
type=str,
help="Path to summary file."
)
parser.add_argument(
"--complete",
default=True,
type=boolean_string,
help="Complete or incomplete verification"
)
parser.add_argument(
"--osip_conv",
default=None,
type=str,
help="OSIP mode of operation for convolutional layers, one of 'on', 'off', 'node_once', 'node_always'"
)
parser.add_argument(
"--osip_conv_nodes",
default=None,
type=int,
help="Number of optimised nodes during OSIP for convolutional layers"
)
parser.add_argument(
"--osip_fc",
default=None,
type=str,
help="OSIP mode of operation for fully connected layers, one of 'on', 'off', 'node_once', 'node_always'"
)
parser.add_argument(
"--osip_fc_nodes",
default=None,
type=int,
help="Number of optimised nodes during OSIP for fully connected layers"
)
parser.add_argument(
"--osip_timelimit",
default=None,
type=int,
help="Timelimit in seconds for OSIP"
)
parser.add_argument(
"--relu_approximation",
default=None,
type=str,
help="Relu approximation: 'min_area' or 'identity' or 'venus' or 'parallel' or 'zero'"
)
parser.add_argument(
"--console_output",
default=None,
type=boolean_string,
help="Console output switch"
)
ARGS = parser.parse_args()
config = Config()
config.set_user(ARGS)
venus = Venus(nn=ARGS.net, spec=ARGS.spec, config=config)
venus.verify()
if __name__ == "__main__":
main()