Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
#!/usr/bin/env python
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
 
import tempfile
import unittest
from pathlib import Path
 
import numpy as np
import onnx
from numpy.testing import assert_almost_equal
from onnx import TensorProto, helper
from op_test_utils import TestDataFeeds, check_model_correctness, check_op_type_count, check_qtype_by_node_type
 
from onnxruntime import GraphOptimizationLevel, InferenceSession, SessionOptions
from onnxruntime.capi.onnxruntime_pybind11_state import Fail
from onnxruntime.capi.onnxruntime_pybind11_state import NotImplemented as OrtNotImplemented
from onnxruntime.quantization import CalibrationMethod, QuantFormat, QuantType, quantize_dynamic, quantize_static
from onnxruntime.quantization.calibrate import entropy
 
 
def skip_if_new_opset_exception_raised(func):
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except Fail as e:
            if "is under development and support for this is limited" in str(e):
                raise unittest.SkipTest(f"Skipped {func} due to opset under development.")  # noqa: B904
            raise
 
    return wrapper
 
 
class TestOpMatMul(unittest.TestCase):
    def test_quantize_matmul_large_finite_range(self):
        for dtype, tensor_type, magnitude in (
            (np.float16, TensorProto.FLOAT16, 40000),
            (np.float32, TensorProto.FLOAT, 3e38),
        ):
            for per_channel in (False, True):
                with self.subTest(dtype=dtype, per_channel=per_channel), tempfile.TemporaryDirectory() as directory:
                    weights = np.array([[-magnitude, -magnitude / 2], [magnitude, magnitude / 2]], dtype=dtype)
                    inputs = {"input": np.eye(2, dtype=dtype)}
                    model = helper.make_model(
                        helper.make_graph(
                            [helper.make_node("MatMul", ["input", "weight"], ["output"])],
                            "large_finite_range",
                            [helper.make_tensor_value_info("input", tensor_type, [2, 2])],
                            [helper.make_tensor_value_info("output", tensor_type, [2, 2])],
                            [onnx.numpy_helper.from_array(weights, "weight")],
                        ),
                        opset_imports=[helper.make_opsetid("", 21)],
                        ir_version=10,
                    )
                    options = SessionOptions()
                    options.graph_optimization_level = GraphOptimizationLevel.ORT_DISABLE_ALL
                    options.intra_op_num_threads = 1
                    if dtype == np.float16:
                        # Calibration also requires a CPU kernel for the original FP16 MatMul.
                        try:
                            InferenceSession(model.SerializeToString(), options, providers=["CPUExecutionProvider"])
                        except OrtNotImplemented as e:
                            if "Could not find an implementation for MatMul" in str(e):
                                self.skipTest("CPU FP16 MatMul kernel is unavailable.")
                            raise
                    output_path = Path(directory) / "quantized.onnx"
                    quantize_static(
                        model,
                        output_path,
                        TestDataFeeds([inputs]),
                        quant_format=QuantFormat.QDQ,
                        activation_type=QuantType.QUInt8,
                        weight_type=QuantType.QInt8,
                        per_channel=per_channel,
                        extra_options={"WeightSymmetric": True},
                    )
                    quantized = onnx.load(output_path)
                    onnx.checker.check_model(quantized)
                    scales = [
                        onnx.numpy_helper.to_array(t) for t in quantized.graph.initializer if t.name.endswith("_scale")
                    ]
                    self.assertTrue(scales)
                    for scale in scales:
                        self.assertTrue(np.isfinite(scale).all())
                        self.assertTrue((scale > 0).all())
 
                    result = InferenceSession(str(output_path), options, providers=["CPUExecutionProvider"]).run(
                        None, inputs
                    )[0]
                    self.assertTrue(np.isfinite(result).all())
                    # Identity input preserves the weights, up to INT8 quantization error.
                    np.testing.assert_allclose(result.astype(np.float64), weights.astype(np.float64), rtol=0.02)
 
    def test_entropy(self):
        try:
            from scipy.stats import entropy as scipy_entropy  # noqa: PLC0415
        except ImportError:
            raise unittest.SkipTest("scipy not installed.")  # noqa: B904
        pk = (np.arange(10) - 5).astype(np.float32) / 10
        qk = -(np.arange(10) - 5).astype(np.float32) / 10
        ent = scipy_entropy(pk, qk)
        get = entropy(pk, qk)
        assert_almost_equal(ent, get)
 
    def input_feeds(self, n, name2shape, dtype):
        input_data_list = []
        for _i in range(n):
            inputs = {}
            for name, shape in name2shape.items():
                inputs.update({name: np.random.randint(-1, 2, shape).astype(dtype)})
            input_data_list.extend([inputs])
        dr = TestDataFeeds(input_data_list)
        return dr
 
    def construct_model_matmul(
        self, output_model_path, add_clip=True, tensor_type=onnx.TensorProto.FLOAT, opset=18, ir_version=8
    ):
        #      (input)
        #         |
        #        MatMul
        #         |
        #        Clip
        #         |
        #        MatMul
        #         |
        #      (output)
        dtype = np.float32 if tensor_type == onnx.TensorProto.FLOAT else np.float16
        input_name = "input"
        output_name = "output"
        initializers = []
 
        def make_matmul(input_name, weight_shape, weight_name, output_name):
            weight_data = np.random.normal(0, 0.1, weight_shape).astype(dtype)
            initializers.append(onnx.numpy_helper.from_array(weight_data, name=weight_name))
            return onnx.helper.make_node("MatMul", [input_name, weight_name], [output_name])
 
        # make mm1 node
        mm1_output_name = "mm1_output"
        mm1_node = make_matmul(
            input_name,
            [10, 100],
            "linear1.weight",
            mm1_output_name,
        )
 
        if add_clip:
            # make Clip
            clip_min_name = "clip_min"
            clip_max_name = "clip_max"
            clip_output_name = "clip_output"
            clip_inputs = [mm1_output_name, clip_min_name, clip_max_name]
            clip_outputs = [clip_output_name]
            initializers.append(onnx.numpy_helper.from_array(np.array(-1.0, dtype=dtype), name=clip_min_name))
            initializers.append(onnx.numpy_helper.from_array(np.array(1.0, dtype=dtype), name=clip_max_name))
            clip_node = onnx.helper.make_node("Clip", clip_inputs, clip_outputs)
 
        else:
            clip_output_name = "clip_output"
            clip_node = onnx.helper.make_node("Identity", [mm1_output_name], [clip_output_name])
 
        # make mm2 node
        mm2_node = make_matmul(
            clip_output_name,
            [100, 10],
            "linear2.weight",
            output_name,
        )
 
        # make graph
        input_tensor = helper.make_tensor_value_info(input_name, tensor_type, [-1, 10])
        output_tensor = helper.make_tensor_value_info(output_name, tensor_type, [-1, 10])
        graph_name = "matmul_test"
        graph = helper.make_graph(
            [mm1_node, clip_node, mm2_node],
            graph_name,
            [input_tensor],
            [output_tensor],
            initializer=initializers,
        )
        model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", opset)])
        model.ir_version = ir_version
 
        onnx.save(model, output_model_path)
 
    @staticmethod
    def str_type(qtype):
        if qtype == QuantType.QUInt8:
            return "u8"
        if qtype == QuantType.QInt8:
            return "s8"
        if qtype == QuantType.QFLOAT8E4M3FN:
            return "f8e4m3fn"
        raise ValueError(f"Unexpected value for qtype={qtype}")
 
    def static_quant_test(
        self,
        model_fp_path,
        data_reader,
        activation_type,
        weight_type,
        extra_options={},  # noqa: B006
        calibrate_method=CalibrationMethod.MinMax,
    ):
        activation_proto_qtype = activation_type.tensor_type
        activation_type_str = self.str_type(activation_type)
        weight_type_str = self.str_type(weight_type)
        model_qtype_path = f"matmul_fp.quant_{activation_type_str}{weight_type_str}.onnx"
 
        data_reader.rewind()
        quantize_static(
            model_fp_path,
            model_qtype_path,
            data_reader,
            quant_format=QuantFormat.QOperator,
            activation_type=activation_type,
            weight_type=weight_type,
            extra_options=extra_options,
            calibrate_method=calibrate_method,
        )
 
        if activation_type == QuantType.QFLOAT8E4M3FN or weight_type == QuantType.QFLOAT8E4M3FN:
            quant_nodes = {"QLinearMatMul": 2, "QuantizeLinear": 2, "DequantizeLinear": 2, "Identity": 1}
            qnode_io_qtypes = {
                "QuantizeLinear": [
                    ["i", 2, activation_proto_qtype],
                    ["o", 0, activation_proto_qtype],
                ]
            }
        else:
            qdq_count = 1 if activation_type != QuantType.QInt8 else 2
            clip_count = 0 if activation_type != QuantType.QInt8 else 1
            quant_nodes = {
                "QLinearMatMul": 2,
                "QuantizeLinear": qdq_count,
                "DequantizeLinear": qdq_count,
                "Clip": clip_count,
            }
            qnode_io_qtypes = {
                "QuantizeLinear": [
                    ["i", 2, activation_proto_qtype],
                    ["o", 0, activation_proto_qtype],
                ]
            }
 
        if activation_type_str == "f8e4m3fn" and weight_type_str == "f8e4m3fn":
            with open(model_qtype_path, "rb") as f:
                onx = onnx.load(f)
 
            nf8 = 0
            for init in onx.graph.initializer:
                if init.data_type not in (TensorProto.FLOAT, TensorProto.FLOAT16, TensorProto.FLOAT8E4M3FN):
                    raise AssertionError(f"Unexpected data_type={init.data_type} for initializer {init.name!r}.")
                if init.data_type == TensorProto.FLOAT8E4M3FN:
                    nf8 += 1
            if nf8 < 4:
                raise AssertionError(f"Unexpected low number of float 8 initializer ({nf8}).")
 
        check_op_type_count(self, model_qtype_path, **quant_nodes)
        qnode_io_qtypes.update({"DequantizeLinear": [["i", 2, activation_proto_qtype]]})
        if activation_type_str != "f8e4m3fn":
            # QLinearMatMul belongs to domain com.microsoft for this type and shape inference does not work
            check_qtype_by_node_type(self, model_qtype_path, qnode_io_qtypes)
        data_reader.rewind()
        if activation_type_str == "f8e4m3fn" and weight_type_str == "f8e4m3fn":
            check_model_correctness(
                self,
                model_fp_path,
                model_qtype_path,
                data_reader.get_next(),
                providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
                is_gemm=True,
                op_matmul=True,
            )
        else:
            check_model_correctness(
                self, model_fp_path, model_qtype_path, data_reader.get_next(), is_gemm=True, op_matmul=True
            )
 
    def static_quant_test_qdq(
        self,
        model_fp_path,
        data_reader,
        activation_type,
        weight_type,
        extra_options={},  # noqa: B006
        calibrate_method=CalibrationMethod.MinMax,
    ):
        activation_proto_qtype = activation_type.tensor_type
        activation_type_str = self.str_type(activation_type)
        weight_type_str = self.str_type(weight_type)
        model_qtype_path = f"matmul_fp.quant_dqd_{activation_type_str}{weight_type_str}.onnx"
 
        data_reader.rewind()
        quantize_static(
            model_fp_path,
            model_qtype_path,
            data_reader,
            quant_format=QuantFormat.QDQ,
            activation_type=activation_type,
            weight_type=weight_type,
            extra_options=extra_options,
            calibrate_method=calibrate_method,
        )
 
        if activation_type == QuantType.QUInt8:
            clip_count = 0
            q_count = 3
            dq_count = 5
            cast_count = 0
        elif activation_type == QuantType.QInt8:
            clip_count = 1
            q_count = 4
            dq_count = 6
            cast_count = 0
        elif activation_type == QuantType.QFLOAT8E4M3FN:
            clip_count = 0
            q_count = 4
            dq_count = 6
            cast_count = 0
        else:
            raise AssertionError(f"Test not implemented for activation_type={activation_type}.")
 
        quant_nodes = {
            "MatMul": 2,
            "QuantizeLinear": q_count,
            "DequantizeLinear": dq_count,
            "Clip": clip_count,
            "Cast": cast_count,
        }
        check_op_type_count(self, model_qtype_path, **quant_nodes)
        qnode_io_qtypes = {
            "QuantizeLinear": [
                ["i", 2, activation_proto_qtype],
                ["o", 0, activation_proto_qtype],
            ]
        }
        check_qtype_by_node_type(self, model_qtype_path, qnode_io_qtypes)
        data_reader.rewind()
        check_model_correctness(
            self, model_fp_path, model_qtype_path, data_reader.get_next(), is_gemm=True, op_matmul=True
        )
 
    def dynamic_quant_test(
        self,
        model_fp_path,
        data_reader,
        activation_type,
        weight_type,
        extra_options={},  # noqa: B006
    ):
        activation_proto_qtype = TensorProto.UINT8 if activation_type == QuantType.QUInt8 else TensorProto.INT8
        activation_type_str = "u8" if (activation_type == QuantType.QUInt8) else "s8"
        weight_type_str = "u8" if (weight_type == QuantType.QUInt8) else "s8"
        model_qtype_path = f"matmul_fp.quant_dynamic_{activation_type_str}{weight_type_str}.onnx"
 
        quantize_dynamic(
            model_fp_path,
            model_qtype_path,
            weight_type=weight_type,
            extra_options=extra_options,
        )
        quant_nodes = {"MatMulInteger": 2}
        check_op_type_count(self, model_qtype_path, **quant_nodes)
        qnode_io_qtypes = {"MatMulInteger": [["i", 2, activation_proto_qtype]]}
        check_qtype_by_node_type(self, model_qtype_path, qnode_io_qtypes)
        data_reader.rewind()
        onx = onnx.load(model_fp_path)
        tt = onx.graph.input[0].type.tensor_type.elem_type
        check_model_correctness(
            self,
            model_fp_path,
            model_qtype_path,
            {"input": np.random.rand(5, 10).astype(np.float32 if tt == onnx.TensorProto.FLOAT else np.float16)},
            dynamic=True,
            is_gemm=True,
            op_matmul=True,
        )
 
    def quantize_matmul_u8u8(self, tt, opset, ir_version):
        np.random.seed(1)
        model_fp_path = "matmul_fp.onnx"
        self.construct_model_matmul(model_fp_path, tensor_type=tt, opset=opset, ir_version=ir_version)
        data_reader = self.input_feeds(
            1, {"input": [5, 10]}, np.float32 if tt == onnx.TensorProto.FLOAT else np.float16
        )
 
        self.static_quant_test(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QUInt8,
            weight_type=QuantType.QUInt8,
        )
        self.static_quant_test_qdq(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QUInt8,
            weight_type=QuantType.QUInt8,
        )
        self.dynamic_quant_test(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QUInt8,
            weight_type=QuantType.QUInt8,
        )
 
    def test_quantize_matmul_u8u8(self):
        self.quantize_matmul_u8u8(onnx.TensorProto.FLOAT, 18, 8)
 
    @unittest.skip(reason="QLinearMatMul(21), which supports float16, is not implemented in ORT.")
    @skip_if_new_opset_exception_raised
    def test_quantize_matmul_u8u8_f16(self):
        self.quantize_matmul_u8u8(onnx.TensorProto.FLOAT16, 21, 9)
 
    def quantize_matmul_s8s8(self, tt, opset, ir_version, calibrate_method=CalibrationMethod.MinMax):
        np.random.seed(1)
        model_fp_path = "matmul_fp.onnx"
        self.construct_model_matmul(model_fp_path, tensor_type=tt, opset=opset, ir_version=ir_version)
        data_reader = self.input_feeds(
            1, {"input": [5, 10]}, np.float32 if tt == onnx.TensorProto.FLOAT else np.float16
        )
 
        self.static_quant_test(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QInt8,
            weight_type=QuantType.QInt8,
            extra_options={"ActivationSymmetric": True},
            calibrate_method=calibrate_method,
        )
        self.static_quant_test_qdq(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QInt8,
            weight_type=QuantType.QInt8,
            extra_options={"ActivationSymmetric": True},
            calibrate_method=calibrate_method,
        )
 
        # dynamic quantization doesn't support activation:int8
        # self.dynamic_quant_test(model_fp_path, data_reader, activation_type=QuantType.QInt8, weight_type=QuantType.QInt8,
        #                        extra_options={'ActivationSymmetric': True})
 
    def test_quantize_matmul_s8s8(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT, 18, 8)
 
    def test_quantize_matmul_s8s8_entropy(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT, 18, 8, calibrate_method=CalibrationMethod.Entropy)
 
    def test_quantize_matmul_s8s8_percentile(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT, 18, 8, calibrate_method=CalibrationMethod.Percentile)
 
    def test_quantize_matmul_s8s8_distribution(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT, 18, 8, calibrate_method=CalibrationMethod.Distribution)
 
    @unittest.skip(reason="QLinearMatMul(21), which supports float16, is not implemented in ORT.")
    @skip_if_new_opset_exception_raised
    def test_quantize_matmul_s8s8_f16(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT16, 21, 9)
 
    @unittest.skip(reason="QLinearMatMul(21), which supports float16, is not implemented in ORT.")
    @skip_if_new_opset_exception_raised
    def test_quantize_matmul_s8s8_f16_entropy(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT16, 21, 9, calibrate_method=CalibrationMethod.Entropy)
 
    @unittest.skip(reason="QLinearMatMul(21), which supports float16, is not implemented in ORT.")
    @skip_if_new_opset_exception_raised
    def test_quantize_matmul_s8s8_f16_percentile(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT16, 21, 9, calibrate_method=CalibrationMethod.Percentile)
 
    @unittest.skip(reason="QLinearMatMul(21), which supports float16, is not implemented in ORT.")
    @skip_if_new_opset_exception_raised
    def test_quantize_matmul_s8s8_f16_distribution(self):
        self.quantize_matmul_s8s8(onnx.TensorProto.FLOAT16, 21, 9, calibrate_method=CalibrationMethod.Distribution)
 
    def quantize_matmul_e4m3fn_same(self, tt, opset, ir_version):
        np.random.seed(1)
        model_fp_path = "matmul_fp.onnx"
        self.construct_model_matmul(model_fp_path, add_clip=False, tensor_type=tt, opset=opset, ir_version=ir_version)
        data_reader = self.input_feeds(
            1, {"input": [5, 10]}, np.float32 if tt == onnx.TensorProto.FLOAT else np.float16
        )
 
        self.static_quant_test_qdq(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QFLOAT8E4M3FN,
            weight_type=QuantType.QFLOAT8E4M3FN,
            extra_options={"scenario": "same"},
            calibrate_method=CalibrationMethod.Distribution,
        )
        self.static_quant_test(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QFLOAT8E4M3FN,
            weight_type=QuantType.QFLOAT8E4M3FN,
            extra_options={"scenario": "same"},
            calibrate_method=CalibrationMethod.Distribution,
        )
 
    def test_quantize_matmul_e4m3fn_same(self):
        self.quantize_matmul_e4m3fn_same(onnx.TensorProto.FLOAT, 18, 8)
 
    @unittest.skip(reason="Too many bins for data range.")
    def test_quantize_matmul_e4m3fn_same_f16(self):
        self.quantize_matmul_e4m3fn_same(onnx.TensorProto.FLOAT16, 19, 9)
 
    def quantize_matmul_e4m3fn_p3(self, tt, opset, ir_version):
        np.random.seed(1)
        model_fp_path = "matmul_fp.onnx"
        self.construct_model_matmul(model_fp_path, add_clip=False, tensor_type=tt, opset=opset, ir_version=ir_version)
        data_reader = self.input_feeds(
            1, {"input": [5, 10]}, np.float32 if tt == onnx.TensorProto.FLOAT else np.float16
        )
 
        self.static_quant_test_qdq(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QFLOAT8E4M3FN,
            weight_type=QuantType.QFLOAT8E4M3FN,
            extra_options={"scenario": "p3"},
            calibrate_method=CalibrationMethod.Distribution,
        )
        self.static_quant_test(
            model_fp_path,
            data_reader,
            activation_type=QuantType.QFLOAT8E4M3FN,
            weight_type=QuantType.QFLOAT8E4M3FN,
            extra_options={"scenario": "p3"},
            calibrate_method=CalibrationMethod.Distribution,
        )
 
    def test_quantize_matmul_e4m3fn_p3(self):
        self.quantize_matmul_e4m3fn_p3(onnx.TensorProto.FLOAT, 18, 8)
 
    @unittest.skip(reason="Too many bins for data range.")
    def test_quantize_matmul_e4m3fn_p3_f16(self):
        self.quantize_matmul_e4m3fn_p3(onnx.TensorProto.FLOAT16, 19, 9)
 
 
if __name__ == "__main__":
    unittest.main(verbosity=2)