ai-edge-quantizer-nightly 0.5.0.dev20260103__py3-none-any.whl → 0.5.0.dev20260126__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.
@@ -87,7 +87,7 @@ def _rotate_with_diagonal_hadamard(
87
87
  hadamard = _make_hadamard_matrix(hadamard_size)
88
88
  reshaped_tensor = tensor_content.reshape(
89
89
  diagonal_size * output_size, hadamard_size)
90
- w_rotated = np.matmul(hadamard, reshaped_tensor.mT).mT
90
+ w_rotated = np.matmul(reshaped_tensor, hadamard)
91
91
  return w_rotated.reshape(tensor_content.shape), hadamard_size, random_vector
92
92
 
93
93
 
@@ -357,7 +357,8 @@ def symmetric_quantize_bias_tensor(
357
357
  bias_content: np.ndarray,
358
358
  input_tensor_quant_params: qtyping.UniformQuantParams,
359
359
  weight_tensor_quant_params: qtyping.UniformQuantParams,
360
- check_error: bool = True,
360
+ # TODO: b/477623376 - Have a debugging mode to check bias.
361
+ check_error: bool = False,
361
362
  ) -> qtyping.UniformQuantParams:
362
363
  """Quantize bias tensor (symmetrically, i.e., zero_point = 0).
363
364
 
@@ -414,7 +414,10 @@ class TensorUtilsTest(parameterized.TestCase):
414
414
  list(bias_quant_config.quantized_data.flatten()), # pytype: disable=attribute-error
415
415
  )
416
416
 
417
- def test_quantize_bias_tensor_raises_error_for_large_quantization_error(self):
417
+ @parameterized.parameters(True, False)
418
+ def test_quantize_bias_tensor_raises_error_for_large_quantization_error(
419
+ self, check_error
420
+ ):
418
421
  input_quant_config = qtyping.UniformQuantParams(
419
422
  scale=np.array([0.1]),
420
423
  zero_point=np.array([10]),
@@ -431,14 +434,26 @@ class TensorUtilsTest(parameterized.TestCase):
431
434
  )
432
435
  # This will result in quantized bias of 3e9, which is larger than int32 max.
433
436
  bias_tensor_data = np.array([3e7])
434
- with self.assertRaisesRegex(
435
- ValueError,
436
- "Quantization error is too large for bias tensor quantization.",
437
- ):
438
- uniform_quantize_tensor.symmetric_quantize_bias_tensor(
439
- bias_tensor_data,
440
- input_quant_config,
441
- weight_quant_config,
437
+
438
+ if check_error:
439
+ with self.assertRaisesRegex(
440
+ ValueError,
441
+ "Quantization error is too large for bias tensor quantization.",
442
+ ):
443
+ uniform_quantize_tensor.symmetric_quantize_bias_tensor(
444
+ bias_tensor_data,
445
+ input_quant_config,
446
+ weight_quant_config,
447
+ check_error
448
+ )
449
+ else:
450
+ self.assertIsNotNone(
451
+ uniform_quantize_tensor.symmetric_quantize_bias_tensor(
452
+ bias_tensor_data,
453
+ input_quant_config,
454
+ weight_quant_config,
455
+ check_error,
456
+ )
442
457
  )
443
458
 
444
459
  @parameterized.parameters((8, True), (16, False))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.5.0.dev20260103
3
+ Version: 0.5.0.dev20260126
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
@@ -11,17 +11,17 @@ Classifier: Intended Audience :: Science/Research
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Scientific/Engineering
19
19
  Classifier: Topic :: Scientific/Engineering :: Mathematics
20
20
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
21
  Classifier: Topic :: Software Development
22
22
  Classifier: Topic :: Software Development :: Libraries
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Requires-Python: >=3.9
24
+ Requires-Python: >=3.10
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
27
  Requires-Dist: absl-py
@@ -32,7 +32,7 @@ ai_edge_quantizer/algorithms/uniform_quantize/common_quantize.py,sha256=_ItPnd2T
32
32
  ai_edge_quantizer/algorithms/uniform_quantize/common_quantize_test.py,sha256=GGf_n3wIeg3GB_eGsmyNJ0fTcxgpeMMbugTMRONK6TQ,3553
33
33
  ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery.py,sha256=VjBDxGxjITHJc7xJABqBbZt6_qhobtZAl2gnVQrYJgc,8652
34
34
  ai_edge_quantizer/algorithms/uniform_quantize/dequantized_weight_recovery_test.py,sha256=sT5eX5TLZEHTtPfnSkCPDlS0sQxlTFWbCsbvOuj--yY,8889
35
- ai_edge_quantizer/algorithms/uniform_quantize/hadamard_rotation.py,sha256=qxt9CPDcidVWIxp5nSWPN2hKKj1XZcsOOLBd2SYIvW0,14572
35
+ ai_edge_quantizer/algorithms/uniform_quantize/hadamard_rotation.py,sha256=rvXBqBk0a3RLq5b3hZlvm3-GygpzCf8dPHa5nOTCg5o,14566
36
36
  ai_edge_quantizer/algorithms/uniform_quantize/hadamard_rotation_test.py,sha256=1ejj5WS3GZwFk3qpsPiPS8jcmVS1-e7zRmvj2Nj8fKw,15440
37
37
  ai_edge_quantizer/algorithms/uniform_quantize/mse.py,sha256=EP5yPw6khAhTo6VNTPXEE2aGKLfNnqz8COeJnTKaGWs,4641
38
38
  ai_edge_quantizer/algorithms/uniform_quantize/mse_test.py,sha256=-E1LIlxadckspltdgBWTiUzsiwbawSubndavHhWLt1g,7145
@@ -40,8 +40,8 @@ ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize.py,sha256=N
40
40
  ai_edge_quantizer/algorithms/uniform_quantize/naive_min_max_quantize_test.py,sha256=Eqa4OUqoCGywbHz-HxJ9dWRj9BKlVzJPuIhVzvrpdLM,8925
41
41
  ai_edge_quantizer/algorithms/uniform_quantize/octav.py,sha256=-n-QZyp9y8WCy5FPSpXZXHfOA-p-RLvfSaCzAfhHiHI,7040
42
42
  ai_edge_quantizer/algorithms/uniform_quantize/octav_test.py,sha256=6m2U-9JdNei0XzOORg2gt87TJdD0XHZ-z5h9c4g_TB4,9120
43
- ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=qZxTj3B-tqNTLCViwuJj285YncvwjWeay2QKWd8nr6A,20420
44
- ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=eTrrc8AGaSf1Ytp5gsRONAZ94PHFJUTd4dGi5ZnKZjU,16038
43
+ ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor.py,sha256=c5z1UEKSlUdO-JB66q2nyan7LJQDs8yJ7Fj3EWxdZP0,20484
44
+ ai_edge_quantizer/algorithms/uniform_quantize/uniform_quantize_tensor_test.py,sha256=2BBSNqB37Smo8t9CZJShlT6JZMpuw4RWRvAGHBTr3OA,16417
45
45
  ai_edge_quantizer/algorithms/utils/__init__.py,sha256=lpq1g2ayg3lCPLy79t2VicYcnGKw64FfYIj1V7J-4m8,676
46
46
  ai_edge_quantizer/algorithms/utils/common_utils.py,sha256=M3VZsdLC4jCPfSI_aGAY4XjiHvoXtR-UyPZdZdz8GD0,38082
47
47
  ai_edge_quantizer/algorithms/utils/common_utils_test.py,sha256=zqapGEfYhjQWe9cNGPLmdbwtEUUYQRhlO_kNe0cXX6E,18104
@@ -74,8 +74,8 @@ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=ptdlC3WVUE9aBznT7kZQ0ZOk
74
74
  ai_edge_quantizer/utils/tfl_interpreter_utils_test.py,sha256=EPOXbmXqbt3tAewo3BQQjh2mjuxrrFit5tkF0wUVYHU,12471
75
75
  ai_edge_quantizer/utils/validation_utils.py,sha256=Mr0D6X-pTDLODFAnCX3IlqdV1OL02tlq0ZjHbqx8nzg,7439
76
76
  ai_edge_quantizer/utils/validation_utils_test.py,sha256=T8K5mCWeMcihND2KS_dHvCJUU9lEdG2sD95EgPkaX3w,5584
77
- ai_edge_quantizer_nightly-0.5.0.dev20260103.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
- ai_edge_quantizer_nightly-0.5.0.dev20260103.dist-info/METADATA,sha256=gJG1WQM6zOnsWl8Fp3axH3YydN3szFTS6qZ05biDrXw,1729
79
- ai_edge_quantizer_nightly-0.5.0.dev20260103.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
- ai_edge_quantizer_nightly-0.5.0.dev20260103.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
- ai_edge_quantizer_nightly-0.5.0.dev20260103.dist-info/RECORD,,
77
+ ai_edge_quantizer_nightly-0.5.0.dev20260126.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
+ ai_edge_quantizer_nightly-0.5.0.dev20260126.dist-info/METADATA,sha256=Ig_vkFCE76VIr9G9219lCKsB97BymmAtiFtR-KgR17k,1731
79
+ ai_edge_quantizer_nightly-0.5.0.dev20260126.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
+ ai_edge_quantizer_nightly-0.5.0.dev20260126.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
+ ai_edge_quantizer_nightly-0.5.0.dev20260126.dist-info/RECORD,,