ai-edge-quantizer-nightly 0.0.1.dev20250306__py3-none-any.whl → 0.0.1.dev20250307__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.
@@ -135,3 +135,33 @@ class BaseOpTestCase(parameterized.TestCase):
135
135
  )
136
136
  for result in signature_result.output_tensors.values():
137
137
  self.assertLess(result, output_tolerance)
138
+
139
+ def assert_quantization_accuracy_and_size(
140
+ self,
141
+ algorithm_key: _AlgorithmName,
142
+ model_path: str,
143
+ op_name: _OpName,
144
+ op_config: _OpQuantConfig,
145
+ expected_model_size_reduction: float,
146
+ weight_tolerance: float = 1e-4,
147
+ output_tolerance: float = 1e-4,
148
+ ):
149
+ """Check if the quantization is successful and the result is valid."""
150
+ validation_result = self.quantize_and_validate(
151
+ model_path=model_path,
152
+ algorithm_key=algorithm_key,
153
+ op_name=op_name,
154
+ op_config=op_config,
155
+ )
156
+ with self.subTest(name='ModelSizeReduction'):
157
+ self.assert_model_size_reduction_above_min_pct(
158
+ validation_result, expected_model_size_reduction
159
+ )
160
+ with self.subTest(name='WeightsErrors'):
161
+ self.assert_weights_errors_below_tolerance(
162
+ validation_result, weight_tolerance
163
+ )
164
+ with self.subTest(name='OutputErrors'):
165
+ self.assert_output_errors_below_tolerance(
166
+ validation_result, output_tolerance
167
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.0.1.dev20250306
3
+ Version: 0.0.1.dev20250307
4
4
  Summary: A quantizer for advanced developers to quantize converted AI Edge models.
5
5
  Home-page: https://github.com/google-ai-edge/ai-edge-quantizer
6
6
  Keywords: On-Device ML,AI,Google,TFLite,Quantization,LLMs,GenAI
@@ -53,15 +53,15 @@ ai_edge_quantizer/transformations/transformation_utils_test.py,sha256=ks81nNvruO
53
53
  ai_edge_quantizer/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V7J-4m8,676
54
54
  ai_edge_quantizer/utils/calibration_utils.py,sha256=1Fj9MIO6aLZIRgyd4axvZN4S_O64nB_-Miu1WP664js,2536
55
55
  ai_edge_quantizer/utils/calibration_utils_test.py,sha256=Z-AcdTieesWFKyKBb08ZXm4Mgu6cvJ4bg2-MJ7hLD10,2856
56
- ai_edge_quantizer/utils/test_utils.py,sha256=gmq3QeyVuMAgYuGp_uZ2Ei0TOCDqW2jD2GcfgcCX9FA,5183
56
+ ai_edge_quantizer/utils/test_utils.py,sha256=HwZCIpO9fJRAhuN6t6voXKOYQtcioFtt_tpkAlDsAYk,6205
57
57
  ai_edge_quantizer/utils/tfl_flatbuffer_utils.py,sha256=pI4JWq_rhp1tRWwNSFMzbWx-3YEQWQir-bM6S88WKIw,10237
58
58
  ai_edge_quantizer/utils/tfl_flatbuffer_utils_test.py,sha256=AbyDxoM62k4ojD8gPdkWo--xe5hlX3t0kobQSA80kuk,7740
59
59
  ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=ZI16i25bAOpnJUBgRg38EH2CuZ55wxyHFScM12RsOwc,12487
60
60
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=Op3JxtOqlrjzmYF18jnnstL1k9xiY9kKJ8S2vklKGkc,11327
61
61
  ai_edge_quantizer/utils/validation_utils.py,sha256=oYw33Sg547AqtGw-choPUJmp9SAKkV46J_ddqSsum2Q,3950
62
62
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=V_qNDikPD4OPB-siOLQCWNVWTAu87h2IgNYt7teFd-o,2934
63
- ai_edge_quantizer_nightly-0.0.1.dev20250306.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
- ai_edge_quantizer_nightly-0.0.1.dev20250306.dist-info/METADATA,sha256=yPtUua8FBDeyCPVB9HTdKU7TYhCXd4HnSEj6NYMRwDQ,1528
65
- ai_edge_quantizer_nightly-0.0.1.dev20250306.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
66
- ai_edge_quantizer_nightly-0.0.1.dev20250306.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
67
- ai_edge_quantizer_nightly-0.0.1.dev20250306.dist-info/RECORD,,
63
+ ai_edge_quantizer_nightly-0.0.1.dev20250307.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
+ ai_edge_quantizer_nightly-0.0.1.dev20250307.dist-info/METADATA,sha256=TkH64RIi7Q690CXFOGKQi7ps2CIkSYf3U9OaX_-yENk,1528
65
+ ai_edge_quantizer_nightly-0.0.1.dev20250307.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
66
+ ai_edge_quantizer_nightly-0.0.1.dev20250307.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
67
+ ai_edge_quantizer_nightly-0.0.1.dev20250307.dist-info/RECORD,,