esp-ppq 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. esp_ppq-0.2.0.dist-info/LICENSE +201 -0
  2. esp_ppq-0.2.0.dist-info/METADATA +237 -0
  3. esp_ppq-0.2.0.dist-info/RECORD +282 -0
  4. esp_ppq-0.2.0.dist-info/WHEEL +4 -0
  5. ppq/IR/README.md +442 -0
  6. ppq/IR/__init__.py +12 -0
  7. ppq/IR/base/__init__.py +0 -0
  8. ppq/IR/base/command.py +165 -0
  9. ppq/IR/base/graph.py +936 -0
  10. ppq/IR/base/opdef.py +958 -0
  11. ppq/IR/deploy.py +136 -0
  12. ppq/IR/morph.py +1197 -0
  13. ppq/IR/processer.py +187 -0
  14. ppq/IR/quantize.py +324 -0
  15. ppq/IR/search.py +690 -0
  16. ppq/IR/training.py +38 -0
  17. ppq/README.md +32 -0
  18. ppq/__init__.py +62 -0
  19. ppq/api/__init__.py +62 -0
  20. ppq/api/espdl_interface.py +365 -0
  21. ppq/api/fsys.py +254 -0
  22. ppq/api/interface.py +981 -0
  23. ppq/api/setting.py +532 -0
  24. ppq/core/README.md +189 -0
  25. ppq/core/__init__.py +73 -0
  26. ppq/core/common.py +115 -0
  27. ppq/core/config.py +21 -0
  28. ppq/core/data.py +311 -0
  29. ppq/core/defs.py +105 -0
  30. ppq/core/ffi.py +350 -0
  31. ppq/core/quant.py +1019 -0
  32. ppq/core/storage.py +108 -0
  33. ppq/csrc/build/.gitignore +3 -0
  34. ppq/csrc/build/readme.md +1 -0
  35. ppq/csrc/cpu/common.h +0 -0
  36. ppq/csrc/cpu/hist_mse.cc +28 -0
  37. ppq/csrc/cpu/hist_mse.h +9 -0
  38. ppq/csrc/cuda/PPQ.h +248 -0
  39. ppq/csrc/cuda/common.cuh +226 -0
  40. ppq/csrc/cuda/common.h +6 -0
  41. ppq/csrc/cuda/floating.cu +331 -0
  42. ppq/csrc/cuda/floating.h +26 -0
  43. ppq/csrc/cuda/isotone.cc +53 -0
  44. ppq/csrc/cuda/isotone.h +6 -0
  45. ppq/csrc/cuda/linear.cu +433 -0
  46. ppq/csrc/cuda/linear.h +22 -0
  47. ppq/csrc/cuda/sort.cu +218 -0
  48. ppq/csrc/cuda/sort.h +25 -0
  49. ppq/csrc/cuda/test.cu +133 -0
  50. ppq/csrc/cuda/test.h +22 -0
  51. ppq/csrc/cuda/train.cu +338 -0
  52. ppq/csrc/cuda/train.h +30 -0
  53. ppq/csrc/export.cc +34 -0
  54. ppq/executor/README.md +203 -0
  55. ppq/executor/__init__.py +3 -0
  56. ppq/executor/base.py +179 -0
  57. ppq/executor/op/__init__.py +3 -0
  58. ppq/executor/op/fp32/fp32_backend.py +0 -0
  59. ppq/executor/op/ppl_dsp/ppl_dsp_backend.py +0 -0
  60. ppq/executor/op/ppl_trt/ppl_gpu_backend.py +0 -0
  61. ppq/executor/op/torch/__init__.py +21 -0
  62. ppq/executor/op/torch/academic.py +12 -0
  63. ppq/executor/op/torch/base.py +72 -0
  64. ppq/executor/op/torch/cuda.py +101 -0
  65. ppq/executor/op/torch/default.py +3753 -0
  66. ppq/executor/op/torch/dsp.py +12 -0
  67. ppq/executor/op/torch/extension.py +12 -0
  68. ppq/executor/op/torch/nxp.py +63 -0
  69. ppq/executor/op/torch/onnx.py +19 -0
  70. ppq/executor/torch.py +700 -0
  71. ppq/lib/README.md +271 -0
  72. ppq/lib/__init__.py +50 -0
  73. ppq/lib/common.py +114 -0
  74. ppq/lib/extension.py +98 -0
  75. ppq/lib/quant.py +223 -0
  76. ppq/log/__init__.py +1 -0
  77. ppq/log/logger.py +152 -0
  78. ppq/parser/__init__.py +25 -0
  79. ppq/parser/ascend_export.py +149 -0
  80. ppq/parser/caffe/__init__.py +0 -0
  81. ppq/parser/caffe/caffe.proto +2143 -0
  82. ppq/parser/caffe/caffe_export_utils.py +651 -0
  83. ppq/parser/caffe/caffe_graph_optim.py +247 -0
  84. ppq/parser/caffe/caffe_import_utils.py +795 -0
  85. ppq/parser/caffe/ppl_caffe_pb2.py +11379 -0
  86. ppq/parser/caffe_exporter.py +561 -0
  87. ppq/parser/caffe_parser.py +71 -0
  88. ppq/parser/espdl/FlatBuffers/Dl/Attribute.py +657 -0
  89. ppq/parser/espdl/FlatBuffers/Dl/AttributeF.py +60 -0
  90. ppq/parser/espdl/FlatBuffers/Dl/AttributeI.py +60 -0
  91. ppq/parser/espdl/FlatBuffers/Dl/AttributeType.py +18 -0
  92. ppq/parser/espdl/FlatBuffers/Dl/DataLocation.py +7 -0
  93. ppq/parser/espdl/FlatBuffers/Dl/Dimension.py +119 -0
  94. ppq/parser/espdl/FlatBuffers/Dl/DimensionValue.py +122 -0
  95. ppq/parser/espdl/FlatBuffers/Dl/DimensionValueType.py +8 -0
  96. ppq/parser/espdl/FlatBuffers/Dl/Function.py +444 -0
  97. ppq/parser/espdl/FlatBuffers/Dl/Graph.py +565 -0
  98. ppq/parser/espdl/FlatBuffers/Dl/MapType.py +116 -0
  99. ppq/parser/espdl/FlatBuffers/Dl/Model.py +379 -0
  100. ppq/parser/espdl/FlatBuffers/Dl/Node.py +302 -0
  101. ppq/parser/espdl/FlatBuffers/Dl/OperatorSetId.py +106 -0
  102. ppq/parser/espdl/FlatBuffers/Dl/OptionalType.py +100 -0
  103. ppq/parser/espdl/FlatBuffers/Dl/SequenceType.py +100 -0
  104. ppq/parser/espdl/FlatBuffers/Dl/StringStringEntry.py +109 -0
  105. ppq/parser/espdl/FlatBuffers/Dl/Tensor.py +705 -0
  106. ppq/parser/espdl/FlatBuffers/Dl/TensorAnnotation.py +151 -0
  107. ppq/parser/espdl/FlatBuffers/Dl/TensorDataType.py +19 -0
  108. ppq/parser/espdl/FlatBuffers/Dl/TensorShape.py +132 -0
  109. ppq/parser/espdl/FlatBuffers/Dl/TensorTypeAndShape.py +116 -0
  110. ppq/parser/espdl/FlatBuffers/Dl/TypeInfo.py +137 -0
  111. ppq/parser/espdl/FlatBuffers/Dl/TypeInfoValue.py +28 -0
  112. ppq/parser/espdl/FlatBuffers/Dl/ValueInfo.py +195 -0
  113. ppq/parser/espdl/FlatBuffers/Dl/Version.py +7 -0
  114. ppq/parser/espdl/FlatBuffers/Dl/__init__.py +0 -0
  115. ppq/parser/espdl/FlatBuffers/__init__.py +0 -0
  116. ppq/parser/espdl/__init__.py +0 -0
  117. ppq/parser/espdl/espdl_typedef.py +164 -0
  118. ppq/parser/espdl/export_patterns.py +948 -0
  119. ppq/parser/espdl/helper.py +909 -0
  120. ppq/parser/espdl/layout_patterns.py +442 -0
  121. ppq/parser/espdl/mapping.py +130 -0
  122. ppq/parser/espdl/requirements.txt +4 -0
  123. ppq/parser/espdl_exporter.py +524 -0
  124. ppq/parser/extension.py +32 -0
  125. ppq/parser/mnn_exporter.py +104 -0
  126. ppq/parser/native.py +60 -0
  127. ppq/parser/ncnn_exporter.py +69 -0
  128. ppq/parser/nxp_exporter.py +88 -0
  129. ppq/parser/onnx_exporter.py +275 -0
  130. ppq/parser/onnx_parser.py +176 -0
  131. ppq/parser/onnxruntime_exporter.py +620 -0
  132. ppq/parser/openvino_exporter.py +144 -0
  133. ppq/parser/ppl.py +72 -0
  134. ppq/parser/qnn_exporter.py +70 -0
  135. ppq/parser/tengine_exporter.py +246 -0
  136. ppq/parser/tensorRT.py +140 -0
  137. ppq/parser/util.py +34 -0
  138. ppq/qat/core.py +102 -0
  139. ppq/quantization/__init__.py +0 -0
  140. ppq/quantization/algorithm/__init__.py +0 -0
  141. ppq/quantization/algorithm/equalization.py +451 -0
  142. ppq/quantization/algorithm/exprimental.py +55 -0
  143. ppq/quantization/algorithm/training.py +590 -0
  144. ppq/quantization/analyse/__init__.py +3 -0
  145. ppq/quantization/analyse/graphwise.py +372 -0
  146. ppq/quantization/analyse/layerwise.py +208 -0
  147. ppq/quantization/analyse/util/__init__.py +96 -0
  148. ppq/quantization/measure/__init__.py +3 -0
  149. ppq/quantization/measure/cosine.py +38 -0
  150. ppq/quantization/measure/norm.py +99 -0
  151. ppq/quantization/measure/statistic.py +12 -0
  152. ppq/quantization/observer/__init__.py +124 -0
  153. ppq/quantization/observer/base.py +30 -0
  154. ppq/quantization/observer/floating.py +144 -0
  155. ppq/quantization/observer/order.py +103 -0
  156. ppq/quantization/observer/range.py +520 -0
  157. ppq/quantization/optim/README.md +155 -0
  158. ppq/quantization/optim/__init__.py +17 -0
  159. ppq/quantization/optim/baking.py +47 -0
  160. ppq/quantization/optim/base.py +98 -0
  161. ppq/quantization/optim/calibration.py +422 -0
  162. ppq/quantization/optim/equalization.py +650 -0
  163. ppq/quantization/optim/exprimental.py +337 -0
  164. ppq/quantization/optim/extension.py +38 -0
  165. ppq/quantization/optim/legacy.py +419 -0
  166. ppq/quantization/optim/morph.py +371 -0
  167. ppq/quantization/optim/parameters.py +215 -0
  168. ppq/quantization/optim/refine.py +681 -0
  169. ppq/quantization/optim/ssd.py +573 -0
  170. ppq/quantization/optim/training.py +1034 -0
  171. ppq/quantization/qfunction/README.md +178 -0
  172. ppq/quantization/qfunction/__init__.py +66 -0
  173. ppq/quantization/qfunction/base.py +12 -0
  174. ppq/quantization/qfunction/floating.py +120 -0
  175. ppq/quantization/qfunction/linear.py +284 -0
  176. ppq/quantization/quantizer/AscendQuantizer.py +137 -0
  177. ppq/quantization/quantizer/DSPQuantizer.py +203 -0
  178. ppq/quantization/quantizer/EspdlQuantizer.py +379 -0
  179. ppq/quantization/quantizer/FP8Quantizer.py +200 -0
  180. ppq/quantization/quantizer/FPGAQuantizer.py +102 -0
  181. ppq/quantization/quantizer/MNNQuantizer.py +83 -0
  182. ppq/quantization/quantizer/MetaxQuantizer.py +204 -0
  183. ppq/quantization/quantizer/MyQuantizer.py +178 -0
  184. ppq/quantization/quantizer/NCNNQuantizer.py +117 -0
  185. ppq/quantization/quantizer/NXPQuantizer.py +126 -0
  186. ppq/quantization/quantizer/ORTQuantizer.py +98 -0
  187. ppq/quantization/quantizer/OpenvinoQuantizer.py +109 -0
  188. ppq/quantization/quantizer/PPLQuantizer.py +107 -0
  189. ppq/quantization/quantizer/README.md +211 -0
  190. ppq/quantization/quantizer/RKNNQuantizer.py +189 -0
  191. ppq/quantization/quantizer/TengineQuantizer.py +99 -0
  192. ppq/quantization/quantizer/TensorRTQuantizer.py +199 -0
  193. ppq/quantization/quantizer/__init__.py +19 -0
  194. ppq/quantization/quantizer/base.py +405 -0
  195. ppq/samples/FP8/fp8_sample.py +154 -0
  196. ppq/samples/Imagenet/Utilities/Imagenet/__init__.py +5 -0
  197. ppq/samples/Imagenet/Utilities/Imagenet/imagenet_util.py +211 -0
  198. ppq/samples/Imagenet/Utilities/__init__.py +10 -0
  199. ppq/samples/Imagenet/evaluation_with_imagenet.py +81 -0
  200. ppq/samples/Onnxruntime/Example_Benchmark.py +40 -0
  201. ppq/samples/Onnxruntime/Example_Fp32.py +15 -0
  202. ppq/samples/Onnxruntime/Example_PTQ.py +75 -0
  203. ppq/samples/Openvino/Example_Benchmark.py +48 -0
  204. ppq/samples/Openvino/Example_Fp32.py +18 -0
  205. ppq/samples/Openvino/Example_PTQ.py +83 -0
  206. ppq/samples/Openvino/Example_QAT.py +52 -0
  207. ppq/samples/QAT/imagenet.py +108 -0
  208. ppq/samples/QAT/myquantizer.py +232 -0
  209. ppq/samples/QAT/trainer.py +146 -0
  210. ppq/samples/QuantZoo/QuantZoo_Imagenet.py +183 -0
  211. ppq/samples/QuantZoo/QuantZoo_OCR.py +156 -0
  212. ppq/samples/QuantZoo/QuantZoo_Pose.py +127 -0
  213. ppq/samples/QuantZoo/QuantZoo_Segmentation.py +140 -0
  214. ppq/samples/QuantZoo/QuantZoo_SuperRes.py +138 -0
  215. ppq/samples/QuantZoo/QuantZoo_Yolo.py +187 -0
  216. ppq/samples/QuantZoo/Readme.md +241 -0
  217. ppq/samples/RKNN/Example_PTQ.py +1 -0
  218. ppq/samples/TensorRT/Benchmark_with_onnx.py +119 -0
  219. ppq/samples/TensorRT/Example_Benchmark.py +5 -0
  220. ppq/samples/TensorRT/Example_Fp32.py +32 -0
  221. ppq/samples/TensorRT/Example_PTQ.py +78 -0
  222. ppq/samples/TensorRT/Example_Profiling.py +13 -0
  223. ppq/samples/TensorRT/Example_QAT.py +52 -0
  224. ppq/samples/TensorRT/Example_Torch2trt.py +73 -0
  225. ppq/samples/TensorRT/create_engine.py +95 -0
  226. ppq/samples/TensorRT/lenet_demo/CMakeLists.txt +26 -0
  227. ppq/samples/TensorRT/lenet_demo/common/ErrorRecorder.h +136 -0
  228. ppq/samples/TensorRT/lenet_demo/common/common.h +989 -0
  229. ppq/samples/TensorRT/lenet_demo/common/logger.cpp +40 -0
  230. ppq/samples/TensorRT/lenet_demo/common/logger.h +36 -0
  231. ppq/samples/TensorRT/lenet_demo/common/logging.h +514 -0
  232. ppq/samples/TensorRT/lenet_demo/common/macros.h +12 -0
  233. ppq/samples/TensorRT/lenet_demo/generate_onnx.py +61 -0
  234. ppq/samples/TensorRT/lenet_demo/lenet_int8.cpp +316 -0
  235. ppq/samples/TensorRT/lenet_demo/lenet_int8.py +187 -0
  236. ppq/samples/TensorRT/trt_infer.py +254 -0
  237. ppq/samples/Tutorial/analyse.py +89 -0
  238. ppq/samples/Tutorial/bestPractice.py +153 -0
  239. ppq/samples/Tutorial/calibration.py +82 -0
  240. ppq/samples/Tutorial/dequantize.py +72 -0
  241. ppq/samples/Tutorial/dispatch.py +166 -0
  242. ppq/samples/Tutorial/execute.py +63 -0
  243. ppq/samples/Tutorial/finetune.py +98 -0
  244. ppq/samples/Tutorial/fusion.py +105 -0
  245. ppq/samples/Tutorial/optimization.py +99 -0
  246. ppq/samples/Tutorial/quantize.py +104 -0
  247. ppq/samples/Tutorial/targetPlatform.py +157 -0
  248. ppq/samples/Yolo/00_FloatModel.py +10 -0
  249. ppq/samples/Yolo/01_Quantization.py +107 -0
  250. ppq/samples/Yolo/02_Quantization.py +60 -0
  251. ppq/samples/Yolo/yolo_5.py +93 -0
  252. ppq/samples/Yolo/yolo_x.py +39 -0
  253. ppq/samples/bert_sample.py +163 -0
  254. ppq/samples/bypass_nms.py +73 -0
  255. ppq/samples/custimize_quant_func.py +78 -0
  256. ppq/samples/custimized_quant.py +86 -0
  257. ppq/samples/dynamic_shape.py +29 -0
  258. ppq/samples/enable_cuda_kernel.py +59 -0
  259. ppq/samples/fp8_sample.py +154 -0
  260. ppq/samples/onnx_converter.py +13 -0
  261. ppq/samples/quantize_caffe_model.py +52 -0
  262. ppq/samples/quantize_dsp.py +48 -0
  263. ppq/samples/quantize_onnx_model.py +42 -0
  264. ppq/samples/quantize_torch_model.py +49 -0
  265. ppq/samples/yolo6_sample.py +158 -0
  266. ppq/scheduler/__init__.py +15 -0
  267. ppq/scheduler/allin.py +47 -0
  268. ppq/scheduler/base.py +75 -0
  269. ppq/scheduler/dispatchers.py +493 -0
  270. ppq/scheduler/perseus.py +228 -0
  271. ppq/utils/OnnxruntimeUtil.py +80 -0
  272. ppq/utils/OpenvinoUtil.py +51 -0
  273. ppq/utils/TensorRTUtil.py +380 -0
  274. ppq/utils/__init__.py +1 -0
  275. ppq/utils/attribute.py +79 -0
  276. ppq/utils/ema.py +16 -0
  277. ppq/utils/fetch.py +108 -0
  278. ppq/utils/graph_editor.py +36 -0
  279. ppq/utils/round.py +139 -0
  280. ppq/utils/write_qparams_caffe2trt.py +107 -0
  281. ppq/utils/write_qparams_onnx2trt.py +96 -0
  282. ppq/utils/write_qparams_to_snpe_dlc.py +46 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2021 OpenPPL
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.1
2
+ Name: esp-ppq
3
+ Version: 0.2.0
4
+ Summary: Quantization tools for esp-dl
5
+ License: Apache V2.0
6
+ Author: xysun
7
+ Author-email: sunxiangyu@espressif.com
8
+ Requires-Python: >=3.8,<4.0
9
+ Classifier: License :: Other/Proprietary License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Dist: cryptography (>=42.0.0)
17
+ Requires-Dist: flatbuffers (>=24.3.0)
18
+ Requires-Dist: numpy (>=1.24.3)
19
+ Requires-Dist: onnx (>=1.14.0)
20
+ Requires-Dist: onnxsim (>=0.4.36)
21
+ Requires-Dist: protobuf (>=3.20.2,<4.0.0)
22
+ Requires-Dist: torch (>=1.12.0,<2.0.0)
23
+ Requires-Dist: tqdm (>=4.0.0)
24
+ Description-Content-Type: text/markdown
25
+
26
+ ![Banner](https://oss.sensetime.com/20210820/9212d4b51db2e186dc39095b9e01cd3a/ccaf7b3f572fbe398f0d42e24435fc59.jpg)
27
+
28
+ ## PPL Quantization Tool 0.6.6 (PPL 量化工具)
29
+
30
+ PPQ 是一个可扩展的、高性能的、面向工业应用的神经网络量化工具。
31
+
32
+ 神经网络量化,作为一种常用的神经网络加速方案自 2016 年以来被广泛地应用。相比于神经网络剪枝与架构搜索,网络量化的泛用性更强,具有较高的工业实用价值。特别是对于端侧芯片而言,在片上面积与功耗都受到限制的场景下,我们总是希望将所有浮点运算转换为定点运算。量化技术的价值在于浮点运算与访存是十分昂贵的,它依赖于复杂的浮点运算器以及较高的访存带宽。如果我们能够在可接受的范围内使用较低位宽的定点运算近似浮点结果,这将使得我们在芯片电路设计、系统功耗、系统延迟与吞吐量等多方面获得显著的优势。
33
+
34
+ 我们正处在时代的浪潮之中,基于神经网络的人工智能正快速发展,图像识别、图像超分辨率、内容生成、模型重建等技术正改变我们的生活。与之俱来的,是不断变化的模型结构,成为摆在模型量化与部署前的第一道难关。为了处理复杂结构,我们设计了完整的计算图逻辑结构与图调度逻辑,这些努力使得 PPQ 能够解析并修改复杂的模型结构,自动判定网络中的量化区与非量化区,并允许用户对调度逻辑进行手动控制。
35
+
36
+ 网络的量化与性能优化是严峻的工程问题,我们希望用户能够参与到网络的量化与部署过程中来,参与到神经网络的性能优化中来。为此我们在 Github 中提供相应的与部署相关学习资料,并在软件设计上刻意强调接口的灵活性。在我们不断的尝试与探索中,我们抽象出量化器这一逻辑类型,负责初始化不同硬件平台上的量化策略,并允许用户自定义网络中每一个算子、每一个张量的量化位宽、量化粒度与校准算法等。我们将量化逻辑重组为27个独立的量化优化过程 (Quantization Optimization Pass),PPQ 的用户可以根据需求任意组合优化过程,完成高度灵活的量化任务。作为 PPQ 的使用者,您能够根据需求新增、修改所有优化过程,探索量化技术的新边界。
37
+
38
+ 这是一个为处理复杂量化任务而生的框架 —— PPQ 的执行引擎是专为量化设计的,截止 PPQ 0.6.6 版本,软件一共内置 99 种常见的 Onnx 算子执行逻辑,并原生支持执行过程中的量化模拟操作。PPQ 可以脱离 Onnxruntime 完成 Onnx 模型的推理与量化。作为架构设计一部分,我们允许用户使用 Python + Pytorch 或 C++ / Cuda 为 PPQ 注册新的算子实现,新的逻辑亦可替换现有的算子实现逻辑。PPQ 允许相同的算子在不同平台上有不同的执行逻辑,从而支撑不同硬件平台的运行模拟。借助定制化的执行引擎与 PPQ Cuda Kernel 的高性能实现,使得 PPQ 具有极其显著的性能优势,往往能以惊人的效率完成量化任务。
39
+
40
+ PPQ 的开发与推理框架关系密切,这使得我们能够了解硬件推理的诸多细节,从而严格控制硬件模拟误差。在国内外众多开源工作者共同努力之下,目前 PPQ 支持与 TensorRT, OpenPPL, Openvino, ncnn, mnn, Onnxruntime, Tengine, Snpe, GraphCore, Metax 等多个推理框架协同工作,并预制了对应量化器与导出逻辑。PPQ 是一个高度可扩展的模型量化框架,借助 ppq.lib 中的函数功能,您能够将 PPQ 的量化能力扩展到其他可能的硬件与推理库上。我们期待与您一起把人工智能带到千家万户之间。
41
+
42
+ #### 在 0.6.6 的版本更新中,我们为你带来了这些功能:
43
+ 1. [FP8 量化规范](https://zhuanlan.zhihu.com/p/574825662),PPQ 现在支持 E4M3, E5M2 等多种规范的 FP8 [量化模拟与训练](https://github.com/openppl-public/ppq/blob/master/ppq/samples/fp8_sample.py)
44
+ 2. [PFL 基础类库](https://github.com/openppl-public/ppq/blob/master/ppq/samples/yolo6_sample.py),PPQ 现在提供一套更为基础的 api 函数帮助你完成更为灵活的量化
45
+ 3. 更为强大的 [图模式匹配](https://github.com/openppl-public/ppq/blob/master/ppq/IR/search.py) 与 [图融合功能](https://github.com/openppl-public/ppq/blob/master/ppq/IR/morph.py)
46
+ 4. 基于 Onnx 的模型 [QAT](https://github.com/openppl-public/ppq/blob/master/ppq/samples/QAT/imagenet.py) 功能
47
+ 5. 全新的 [TensorRT](https://github.com/openppl-public/ppq/blob/master/md_doc/deploy_trt_by_OnnxParser.md) 量化与导出逻辑
48
+ 6. 全球最大的量化模型库 [OnnxQuant](https://github.com/openppl-public/ppq/tree/master/ppq/samples/QuantZoo)
49
+ 7. 其他未知的软件特性
50
+
51
+ ### Installation (安装方法)
52
+
53
+ 1. Install CUDA from [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit-archive)
54
+
55
+ 2. Install Complier
56
+
57
+ ```bash
58
+ apt-get install ninja-build # for debian/ubuntu user
59
+ yum install ninja-build # for redhat/centos user
60
+ ```
61
+
62
+ For Windows User:
63
+
64
+ (1) Download ninja.exe from [https://github.com/ninja-build/ninja/releases](https://github.com/ninja-build/ninja/releases), add it to Windows PATH.
65
+
66
+ (2) Install Visual Studio 2019 from [https://visualstudio.microsoft.com](https://visualstudio.microsoft.com/zh-hans/).
67
+
68
+ (3) Add your C++ compiler to Windows PATH Environment, if you are using Visual Studio, it should be like "C:\Program Files\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86"
69
+
70
+ (4) Update PyTorch version to 1.10+.
71
+
72
+ 3. Install PPQ
73
+
74
+ ```bash
75
+ git clone https://github.com/openppl-public/ppq.git
76
+ cd ppq
77
+ pip install -r requirements.txt
78
+ python setup.py install
79
+ ```
80
+
81
+ * Install PPQ from our docker image (optional):
82
+
83
+ ```bash
84
+ docker pull stephen222/ppq:ubuntu18.04_cuda11.4_cudnn8.4_trt8.4.1.5
85
+
86
+ docker run -it --rm --ipc=host --gpus all --mount type=bind,source=your custom path,target=/workspace stephen222/ppq:ubuntu18.04_cuda11.4_cudnn8.4_trt8.4.1.5 /bin/bash
87
+
88
+ git clone https://github.com/openppl-public/ppq.git
89
+ cd ppq
90
+ export PYTHONPATH=${PWD}:${PYTHONPATH}
91
+ ```
92
+
93
+ * Install PPQ using pip (optional):
94
+
95
+ ```bash
96
+ python3 -m pip install ppq
97
+ ```
98
+
99
+ ### Learning Path (学习路线)
100
+
101
+ #### PPQ 基础用法及示例脚本
102
+ | | **Description 介绍** | **Link 链接** |
103
+ | :-: | :- | :-: |
104
+ | 01 | 模型量化 | [onnx](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/quantize.py), [caffe](https://github.com/openppl-public/ppq/blob/master/ppq/samples/quantize_caffe_model.py), [pytorch](https://github.com/openppl-public/ppq/blob/master/ppq/samples/quantize_torch_model.py) |
105
+ | 02 | 执行器 | [executor](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/execute.py) |
106
+ | 03 | 误差分析 | [analyser](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/analyse.py) |
107
+ | 04 | 校准器 | [calibration](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/calibration.py) |
108
+ | 05 | 网络微调 | [finetune](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/finetune.py) |
109
+ | 06 | 网络调度 | [dispatch](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/dispatch.py) |
110
+ | 07 | 最佳实践 | [Best Practice](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/bestPractice.py) |
111
+ | | | |
112
+ | 08 | 目标平台 | [platform](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/targetPlatform.py) |
113
+ | 09 | 优化过程 | [Optim](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/optimization.py) |
114
+ | 10 | 图融合 | [Fusion](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Tutorial/fusion.py) |
115
+
116
+ #### PPQ 优化过程文档
117
+ | | **Description 介绍** | **Link 链接** |
118
+ | :-: | :-: | :-: |
119
+ | 01 | QuantSimplifyPass(通用量化精简过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/QuantSimplify.md) |
120
+ | 02 | QuantFusionPass(通用量化图融合过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/QuantFusion.md) |
121
+ | 03 | QuantAlignmentPass(通用量化对齐过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/QuantAlignment.md) |
122
+ | 04 | RuntimeCalibrationPass(参数校准过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/RuntimeCalibrationPass.md) |
123
+ | 05 | BiasCorrectionPass(Bias修正过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/BiasCorrectionPass.md) |
124
+ | 06 | QuantSimplifyPass(通用量化精简过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/QuantSimplify.md) |
125
+ | 07 | LayerwiseEqualizationPass(层间权重均衡过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/LayerwiseEqualization.md) |
126
+ | 08 | LayerSpilitPass(算子分裂过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/LayerSpilit.md) |
127
+ | 09 | LearnedStepSizePass(网络微调过程) | [doc](https://github.com/openppl-public/ppq/blob/master/md_doc/Passes/LearnedStepSizePass.md) |
128
+ | 10 | Other(其他) | [refer to](https://github.com/openppl-public/ppq/tree/master/ppq/quantization/optim) |
129
+
130
+ #### 视频资料
131
+ | | **Desc 介绍** | **Link 链接** |
132
+ | :-: | :-: | :-: |
133
+ | 01 | 计算机体系结构基础知识 | [link](https://www.bilibili.com/video/BV1gS4y1Y7KR) |
134
+ | 02 | 网络性能分析 | [link](https://www.bilibili.com/video/BV1oT4y1h73e) |
135
+ | 03 | 量化计算原理 | [part1](https://www.bilibili.com/video/BV1fB4y1m7fJ), [part2](https://www.bilibili.com/video/BV1qA4y1Q7Uh) |
136
+ | 04 | 图优化与量化模拟 | [link](https://www.bilibili.com/video/BV1Kr4y1n7cy) |
137
+ | 05 | 图调度与模式匹配 | [link](https://www.bilibili.com/video/BV1xY411A7ea) |
138
+ | 06 | 神经网络部署 | [link](https://www.bilibili.com/video/BV1t34y1E7Fz) |
139
+ | 07 | 量化参数选择 | [link](https://www.bilibili.com/video/BV1QF41157aM) |
140
+ | 08 | 量化误差传播分析 | [link](https://www.bilibili.com/video/BV1CU4y1q7tr) |
141
+
142
+ #### 量化部署教程
143
+ | **使用例子(Examples)** | **网络部署平台(Platform)** | **输入模型格式(Format)** | **链接(Link)** | **相关视频(Video)** |
144
+ | :- | :-: | :-: | :-: | :-: |
145
+ | `TensorRT` | | | | |
146
+ | 使用 Torch2trt 加速你的网络 | pytorch | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/TensorRT/Example_Torch2trt.py) | [link](https://www.bilibili.com/video/BV1AU4y127Uo) |
147
+ | TensorRT 量化训练 | TensorRT | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/TensorRT/Example_QAT.py) | [link](https://www.bilibili.com/video/BV1AU4y127Uo) |
148
+ | TensorRT 后训练量化(PPQ) | TensorRT | onnx |<p align="left">[1. Quant with TensorRT OnnxParser](https://github.com/openppl-public/ppq/blob/master/md_doc/deploy_trt_by_OnnxParser.md)<p align="left">[2. Quant with TensorRT API](https://github.com/openppl-public/ppq/blob/master/md_doc/deploy_trt_by_api.md)| |
149
+ | TensorRT fp32 部署 | TensorRT | onnx | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/TensorRT/Example_Fp32.py) | [link](https://www.bilibili.com/video/BV1AU4y127Uo) |
150
+ | TensorRT 性能比较 | TensorRT | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/TensorRT/Example_Benchmark.py) | [link](https://www.bilibili.com/video/BV1AU4y127Uo) |
151
+ | TensorRT Profiler | TensorRT | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/TensorRT/Example_Profiling.py) | [link](https://www.bilibili.com/video/BV1AU4y127Uo) |
152
+ | `onnxruntime` | | | | |
153
+ | 使用 onnxruntime 加速你的网络 | onnxruntime | onnx | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Onnxruntime/Example_Fp32.py) | [link](https://www.bilibili.com/video/BV1t34y1E7Fz "Network Deploy") |
154
+ | onnx 后训练量化(PPQ) | onnxruntime | onnx | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Onnxruntime/Example_PTQ.py) | [link](https://www.bilibili.com/video/BV1t34y1E7Fz "Network Deploy") |
155
+ | onnxruntime 性能比较 | onnxruntime | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Onnxruntime/Example_Benchmark.py) | [link](https://www.bilibili.com/video/BV1t34y1E7Fz "Network Deploy") |
156
+ | `openvino` | | | | |
157
+ | 使用 openvino 加速你的网络 | openvino | onnx | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Openvino/Example_Fp32.py) ||
158
+ | openvino 量化训练 | openvino | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Openvino/Example_QAT.py) ||
159
+ | openvino 后训练量化(PPQ) | openvino | onnx | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Openvino/Example_PTQ.py) ||
160
+ | openvino 性能比较 | openvino | pytorch | [link](https://github.com/openppl-public/ppq/blob/master/ppq/samples/Openvino/Example_Benchmark.py) ||
161
+ | `snpe` | | | | |
162
+ | snpe 后训练量化(PPQ) | snpe | caffe | [link](https://github.com/openppl-public/ppq/blob/master/md_doc/inference_with_snpe_dsp.md) ||
163
+ | `ncnn` | | | | |
164
+ | ncnn 后训练量化(PPQ) | ncnn | onnx | [link](https://github.com/openppl-public/ppq/blob/master/md_doc/inference_with_ncnn.md) ||
165
+ | `OpenPPL` | | | | |
166
+ | ppl cuda 后训练量化(PPQ) | ppl cuda | onnx | [link](https://github.com/openppl-public/ppq/blob/master/md_doc/inference_with_ppl_cuda.md) ||
167
+
168
+ #### Dive into PPQ 深入理解量化框架
169
+ | | **Desc 介绍** | **Link 链接** |
170
+ | :-: | :-: | :-: |
171
+ | 01 | PPQ 量化执行流程 | [link](https://www.bilibili.com/video/BV1kt4y1b75m) |
172
+ | 02 | PPQ 网络解析 | [link](https://www.bilibili.com/video/BV16B4y1h7u4) |
173
+ | 03 | PPQ 量化图调度 | [link](https://www.bilibili.com/video/BV1ig411f7f5) |
174
+ | 04 | PPQ 目标平台与 TQC | [link](https://www.bilibili.com/video/BV1Lf4y1o7Zd) |
175
+ | 05 | PPQ 量化器 | [link](https://www.bilibili.com/video/BV1494y1971i) |
176
+ | 06 | PPQ 量化优化过程 | [link](https://www.bilibili.com/video/BV1zT411g7Ly) |
177
+ | 07 | PPQ 量化函数 | [link](https://www.bilibili.com/video/BV1CU4y1q7tr) |
178
+
179
+ ### Contact Us
180
+
181
+ | WeChat Official Account | QQ Group |
182
+ | :----:| :----: |
183
+ | OpenPPL | 627853444 |
184
+ | ![OpenPPL](assets/OpenPPL.jpg)| ![QQGroup](assets/QQGroup.jpg) |
185
+
186
+ Email: openppl.ai@hotmail.com
187
+
188
+ ### Other Resources
189
+
190
+ * [Sensetime Parrots](https://www.sensetime.com/cn)
191
+ * [Sensetime Parrots Primitive Libraries](https://github.com/openppl-public/ppl.nn)
192
+ * [Sensetime mmlab](https://github.com/open-mmlab)
193
+
194
+ ### Contributions
195
+
196
+ We appreciate all contributions. If you are planning to contribute back bug fixes, please do so without any further discussion.
197
+
198
+ If you plan to contribute new features, utility functions, or extensions to the core, please first open an issue and discuss the feature with us. Sending a PR without discussion might end up resulting in a rejected PR because we might be taking the core in a different direction than you might be aware of.
199
+
200
+ ### Benchmark
201
+
202
+ PPQ is tested with models from mmlab-classification, mmlab-detection, mmlab-segamentation, mmlab-editing, here we listed part of out testing result.
203
+
204
+ * No quantization optimization procedure is applied with following models.
205
+
206
+ | Model | Type | Calibration | Dispatcher | Metric | PPQ(sim) | PPLCUDA | FP32 |
207
+ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
208
+ | Resnet-18 | Classification | 512 imgs | conservative | Acc-Top-1 | 69.50% | 69.42% | 69.88% |
209
+ | ResNeXt-101 | Classification | 512 imgs | conservative | Acc-Top-1 | 78.46% | 78.37% | 78.66% |
210
+ | SE-ResNet-50 | Classification | 512 imgs | conservative | Acc-Top-1 | 77.24% | 77.26% | 77.76% |
211
+ | ShuffleNetV2 | Classification | 512 imgs | conservative | Acc-Top-1 | 69.13% | 68.85% | 69.55% |
212
+ | MobileNetV2 | Classification | 512 imgs | conservative | Acc-Top-1 | 70.99% | 71.1% | 71.88% |
213
+ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
214
+ | retinanet | Detection | 32 imgs | pplnn | bbox_mAP | 36.1% | 36.1% | 36.4% |
215
+ | faster_rcnn | Detection | 32 imgs | pplnn | bbox_mAP | 36.6% | 36.7% | 37.0% |
216
+ | fsaf | Detection | 32 imgs | pplnn | bbox_mAP | 36.5% | 36.6% | 37.4% |
217
+ | mask_rcnn | Detection | 32 imgs | pplnn | bbox_mAP | 37.7% | 37.6% | 37.9% |
218
+ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
219
+ | deeplabv3 | Segmentation | 32 imgs | conservative | aAcc / mIoU | 96.13% / 78.81% | 96.14% / 78.89% | 96.17% / 79.12% |
220
+ | deeplabv3plus | Segmentation | 32 imgs | conservative | aAcc / mIoU | 96.27% / 79.39% | 96.26% / 79.29% | 96.29% / 79.60% |
221
+ | fcn | Segmentation | 32 imgs | conservative | aAcc / mIoU | 95.75% / 74.56% | 95.62% / 73.96% | 95.68% / 72.35% |
222
+ | pspnet | Segmentation | 32 imgs | conservative | aAcc / mIoU | 95.79% / 77.40% | 95.79% / 77.41% | 95.83% / 77.74% |
223
+ | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
224
+ | srcnn | Editing | 32 imgs | conservative | PSNR / SSIM | 27.88% / 79.70% | 27.88% / 79.07% | 28.41% / 81.06% |
225
+ | esrgan | Editing | 32 imgs | conservative | PSNR / SSIM | 27.84% / 75.20% | 27.49% / 72.90% | 27.51% / 72.84% |
226
+
227
+ * PPQ(sim) stands for PPQ quantization simulator's result.
228
+ * Dispatcher stands for dispatching policy of PPQ.
229
+ * Classification models are evaluated with ImageNet, Detection and Segmentation models are evaluated with the COCO dataset, Editing models are evaluated with DIV2K dataset.
230
+ * All calibration datasets are randomly picked from training data.
231
+
232
+ ### License
233
+
234
+ ![Logo](assets/logo.png)
235
+
236
+ This project is distributed under the [Apache License, Version 2.0](LICENSE).
237
+