API
Verifier
Base verifier class.
CompleteVerifier
Bases: Verifier
Abstract class for complete verifiers.
Source code in autoverify/verifier/verifier.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
set_timeout_event()
verify_batch(instances, *, config=None)
Verify a batch. Not yet implemented.
Source code in autoverify/verifier/verifier.py
verify_instance(instance, *, config=None)
See the verify_property
docstring.
Source code in autoverify/verifier/verifier.py
verify_property(network, property, *, config=None, timeout=DEFAULT_VERIFICATION_TIMEOUT_SEC)
Verify the property on the network.
Runs the verifier and feeds the network/property instance as input.
Complete verification will result in one of the following three
possibilities: SAT
, UNSAT
, TIMEOUT
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
network |
Path
|
The |
required |
property |
Path
|
The |
required |
config |
Configuration | Path | None
|
The configuration of the verification tool to be used. If
|
None
|
timeout |
int
|
The maximum number of seconds that can be spent on the verification query. |
DEFAULT_VERIFICATION_TIMEOUT_SEC
|
Returns:
Name | Type | Description |
---|---|---|
CompleteVerificationResult |
CompleteVerificationResult
|
A |
Source code in autoverify/verifier/verifier.py
Verifier
Bases: ABC
Abstract class to represent a verifier tool.
Source code in autoverify/verifier/verifier.py
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 |
|
conda_env_name: str
property
The conda environment name associated with the verifier.
config_space: ConfigurationSpace
abstractmethod
property
Configuration space to sample from.
contexts: list[ContextManager[None]] | None
abstractmethod
property
Contexts to run the verification in.
default_config: Configuration
property
Return the default configuration.
name: str
abstractmethod
property
Unique verifier name.
tool_path: Path
property
The path where the verifier is installed.
__init__(batch_size=512, cpu_gpu_allocation=None)
New instance. This is used with super calls.
get_init_attributes()
is_same_config(config1, config2)
staticmethod
sample_configuration(*, size=1)
Sample one or more configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size |
int
|
The number of configurations to sample. |
1
|
Returns:
Type | Description |
---|---|
Configuration | list[Configuration]
|
Configuration | list[Configuration]: The sampled configuration(s). |
Source code in autoverify/verifier/verifier.py
Classes for data about verification.
CompleteVerificationData
dataclass
Class holding data about a verification run.
Attributes:
Name | Type | Description |
---|---|---|
result |
VerificationResultString
|
Outcome (e.g. SAT, UNSAT...) |
took |
float
|
Walltime spent |
counter_example |
str | None
|
Example that violates property (if SAT) |
err |
str
|
stderr |
stdout |
str
|
stdout |
Source code in autoverify/verifier/verification_result.py
AB-Crown
AbCrown
Bases: CompleteVerifier
AB-Crown.
Source code in autoverify/verifier/complete/abcrown/verifier.py
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 |
|
__init__(batch_size=512, cpu_gpu_allocation=None, yaml_override=None)
New instance.
Source code in autoverify/verifier/complete/abcrown/verifier.py
nnenum
Nnenum
Bases: CompleteVerifier
Nnenum.
Source code in autoverify/verifier/complete/nnenum/verifier.py
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 |
|
__init__(batch_size=512, cpu_gpu_allocation=None, use_auto_settings=True)
New instance.
Source code in autoverify/verifier/complete/nnenum/verifier.py
is_same_config(config1, config2)
staticmethod
Return if two configs are equivalent.
Source code in autoverify/verifier/complete/nnenum/verifier.py
Oval-BaB
OvalBab
Bases: CompleteVerifier
Oval-BaB.
Source code in autoverify/verifier/complete/ovalbab/verifier.py
__init__(batch_size=512, cpu_gpu_allocation=None)
New instance.
Source code in autoverify/verifier/complete/ovalbab/verifier.py
VeriNet
Verinet
Bases: CompleteVerifier
VeriNet.
Source code in autoverify/verifier/complete/verinet/verifier.py
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 |
|
__init__(batch_size=512, cpu_gpu_allocation=None, gpu_mode=True, input_shape=None, dnnv_simplify=False, transpose_matmul_weights=False)
New instance.
Source code in autoverify/verifier/complete/verinet/verifier.py
Portfolio
Parallel portfolio.
ConfiguredVerifier
dataclass
Class representing an interal configured verifier.
Attributes:
Name | Type | Description |
---|---|---|
verifier |
str
|
Name of the verifier. |
configuration |
Configuration
|
Its configuration. |
resources |
tuple[int, int] | None
|
Number of cores and GPUs. |
Source code in autoverify/portfolio/portfolio.py
Portfolio
Bases: MutableSet[ConfiguredVerifier]
Portfolio of ConfiguredVerifiers.
Source code in autoverify/portfolio/portfolio.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
configs: list[Configuration]
property
All the configurations in the PF.
__contains__(cv)
__init__(*cvs)
__iter__()
__len__()
__str__()
add(cv)
Add a CV to the PF, no duplicates allowed.
discard(cv)
dump_costs()
from_json(json_file, config_space_map=None)
classmethod
Instantiate a new Portfolio class from a JSON file.
Source code in autoverify/portfolio/portfolio.py
get_all_costs()
get_cost(instance)
get_costs(instances)
Get costs of more than one instance.
Source code in autoverify/portfolio/portfolio.py
get_mean_cost()
get_median_cost()
get_set()
get_total_cost()
reallocate_resources(strategy=ResourceStrategy.Auto)
Realloacte based on current contents and given strategy.
Source code in autoverify/portfolio/portfolio.py
str_compact()
Get the portfolio in string form in a compact way.
Source code in autoverify/portfolio/portfolio.py
to_json(out_json_path)
Write the portfolio in JSON format to the specified path.
Source code in autoverify/portfolio/portfolio.py
update_costs(costs)
Upate the costs based on the new costs mapping.
Source code in autoverify/portfolio/portfolio.py
PortfolioScenario
dataclass
Scenario for constructing a parallel portfolio.
Attributes:
Name | Type | Description |
---|---|---|
verifiers |
Sequence[str]
|
The name of the verifiers to consider. |
resources |
list[tuple[str, int, int]]
|
How many cores and GPUs the verifiers need. |
instances |
Sequence[VerificationInstance]
|
The instances on which the PF is constructed. |
length |
int
|
The max length of the PF. |
seconds_per_iter |
float
|
Number of seconds for each Hydra iteration. |
configs_per_iter |
int
|
Number of configs each iteration. |
alpha |
float
|
Tune/Pick time split. |
added_per_iter |
int
|
Entries added to the PF per iter. |
stop_early |
bool
|
Stop procedure if some early stop conditions are met. |
resource_strategy |
ResourceStrategy
|
Strat to divide the resources. |
output_dir |
Path | None
|
Dir where logs are stored. |
vnn_compat_mode |
bool
|
Use vnn compatability for some verifiers. |
benchmark |
str | None
|
VNNCOMP benchmark if vnn_compat_mode is |
verifier_kwargs |
dict[str, dict[str, Any]] | None
|
Kwargs passed to verifiers. |
uses_simplified_network |
Iterable[str] | None
|
If the network uses the dnnv simplified nets. |
Source code in autoverify/portfolio/portfolio.py
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 |
|
__post_init__()
Validate the PF scenario.
Source code in autoverify/portfolio/portfolio.py
get_smac_instances()
Get the instances of the scenario as SMAC instances.
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: The SMAC instances. |
get_smac_scenario_kwargs()
Return the SMAC scenario kwargs as a dict.
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: The SMAC scenario as a dict. |
Source code in autoverify/portfolio/portfolio.py
Class to run parallel portfolio.
PortfolioRunner
Class to run a portfolio in parallel.
Source code in autoverify/portfolio/portfolio_runner.py
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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
|
__init__(portfolio, vbs_mode=False, *, n_cpu=None, n_gpu=None)
Initialize a new portfolio runner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
portfolio |
Portfolio
|
The portfolio that will be run. |
required |
vbs_mode |
bool
|
If the PF will be run in VBS mode. |
False
|
n_cpu |
int | None
|
Override number of CPUs |
None
|
n_gpu |
int | None
|
Override number of GPUs. |
None
|
Source code in autoverify/portfolio/portfolio_runner.py
evaluate_vbs(instances, *, out_csv=None, vnncompat=False, benchmark=None)
Evaluate the PF in vbs mode.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instances |
list[VerificationInstance]
|
Instances to evaluate. |
required |
out_csv |
Path | None
|
File where the results are written to. |
None
|
vnncompat |
bool
|
Use some compat kwargs. |
False
|
benchmark |
str | None
|
Only if vnncompat, benchmark name. |
None
|
Source code in autoverify/portfolio/portfolio_runner.py
verify_instances(instances, *, out_csv=None, vnncompat=False, benchmark=None, verifier_kwargs=None, uses_simplified_network=None)
Run the PF in parallel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instances |
Iterable[VerificationInstance]
|
Instances to evaluate. |
required |
out_csv |
Path | None
|
File where the results are written to. |
None
|
vnncompat |
bool
|
Use some compat kwargs. |
False
|
benchmark |
str | None
|
Only if vnncompat, benchmark name. |
None
|
verifier_kwargs |
dict[str, dict[str, Any]] | None
|
Kwargs passed to verifiers. |
None
|
uses_simplified_network |
Iterable[str] | None
|
Have some verifiers use simplified nets. |
None
|
Source code in autoverify/portfolio/portfolio_runner.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
|
Util
summary.
VerificationDataResult
dataclass
summary.
Source code in autoverify/util/instances.py
__post_init__()
as_csv_row()
Convert data to a csv row writeable.
Source code in autoverify/util/instances.py
from_verification_result(verif_res, instance_data)
classmethod
Create from a CompleteVerificationData
.
Source code in autoverify/util/instances.py
csv_append_verification_result(verification_result, csv_path)
summary.
Source code in autoverify/util/instances.py
init_verification_result_csv(csv_path)
read_all_vnncomp_instances(vnncomp_path)
Reads all benchmarks, see the read_vnncomp_instances
docstring.
Source code in autoverify/util/instances.py
read_verification_result_from_csv(csv_path)
Reads a verification results csv to a list of its dataclass.
Source code in autoverify/util/instances.py
read_vnncomp_instances(benchmark, vnncomp_path, *, predicate=None, as_smac=False, resolve_paths=True, instance_file_name='instances.csv')
Read the instances of a VNNCOMP benchmark.
Reads the CSV file of a VNNCOMP benchmark, parsing the network, property and timeout values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
benchmark |
str
|
The name of the benchmark directory. |
required |
vnncomp_path |
Path
|
The path to the VNNCOMP benchmark directory |
required |
predicate |
_InstancePredicate | Iterable[_InstancePredicate] | None
|
A function that, given a |
None
|
as_smac |
bool
|
Return the instances as smac instance strings. |
False
|
Returns:
Type | Description |
---|---|
list[VerificationInstance] | list[str]
|
list[VerificationInstance] | list[str]: A list of
|
Source code in autoverify/util/instances.py
unique_networks(instances)
Utility function to keep only unique networks.
Source code in autoverify/util/instances.py
verification_instances_to_smac_instances(instances)
Convert a list of VerificationInstace
objects to SMAC instances.
See the as_smac_instance
docstring of the VerificationInstance
class for
more details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instances |
Sequence[VerificationInstance]
|
The list of |
required |
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: The SMAC instance strings. |
Source code in autoverify/util/instances.py
write_verification_results_to_csv(results, csv_path)
VerificationInstance.
VerificationInstance
dataclass
VerificationInstance class.
Attributes:
Name | Type | Description |
---|---|---|
network |
Path
|
The |
property |
Path
|
The |
timeout |
int
|
Maximum wallclock time. |
Source code in autoverify/util/verification_instance.py
__hash__()
__str__()
as_row(resolve_paths=True)
Returns the instance as a list of strings.
Source code in autoverify/util/verification_instance.py
as_simplified_network()
Changes the network path.
Assumes a "onnx_simplified" dir is present at the same level.
Source code in autoverify/util/verification_instance.py
as_smac_instance()
Return the instance in a f"{network},{property},{timeout}"
format.
A SMAC instance has to be passed as a single string to the target_function, in which we split the instance string on the comma again to obtain the network, property and timeout.
If no timeout is specified, the DEFAULT_VERIFICATION_TIMEOUT_SEC
global is used.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The smac instance string |
Source code in autoverify/util/verification_instance.py
from_str(str_instance)
classmethod
Create from a comma seperated string.
Verifier VNNCOMP compatability.
Return verifier instances that should be compatible with the given benchmark + instance.
inst_bench_to_kwargs(benchmark, verifier, instance)
Get the kwargs for a benchmark.
Source code in autoverify/util/vnncomp.py
inst_bench_to_verifier(benchmark, instance, verifier, allocation=None)
Get an instantiated verifier.
Source code in autoverify/util/vnncomp.py
inst_bench_verifier_config(benchmark, instance, verifier, configs_dir)
Return the verifier and the VNNCOMP config.