ai-edge-quantizer-nightly 0.5.0.dev20251215__py3-none-any.whl → 0.5.0.dev20251216__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.
@@ -108,6 +108,11 @@ class RecipeManager:
108
108
  configuration will be used.
109
109
  algorithm_key: Algorithm key to be applied.
110
110
  """
111
+ try:
112
+ algorithm_manager.AlgorithmName(algorithm_key)
113
+ except ValueError as e:
114
+ raise ValueError(f'Unsupported algorithm key: {algorithm_key}.') from e
115
+
111
116
  if op_config is None:
112
117
  op_config = _OpQuantizationConfig()
113
118
 
@@ -241,19 +241,6 @@ class ConfiguratorTest(parameterized.TestCase, googletest.TestCase):
241
241
  compute_precision=_ComputePrecision.INTEGER, # DRQ.
242
242
  ),
243
243
  )
244
- # Add unregistered algorithm
245
- with self.assertRaisesWithPredicateMatch(
246
- ValueError, lambda err: error_message in str(err)
247
- ):
248
- self._recipe_manager.add_quantization_config(
249
- regex='.*/Dense/.*',
250
- operation_name=_TFLOpName.FULLY_CONNECTED,
251
- algorithm_key='AWQ',
252
- op_config=qtyping.OpQuantizationConfig(
253
- weight_tensor_config=_TensorQuantConfig(num_bits=8),
254
- compute_precision=_ComputePrecision.INTEGER, # DRQ.
255
- ),
256
- )
257
244
 
258
245
  def test_add_unsupported_num_bits_raise_error(self):
259
246
  test_op_name = _TFLOpName.FULLY_CONNECTED
@@ -293,6 +280,31 @@ class ConfiguratorTest(parameterized.TestCase, googletest.TestCase):
293
280
  # DRQ check.
294
281
  self.assertEqual(op_config.compute_precision, _ComputePrecision.INTEGER)
295
282
 
283
+ def test_add_unsupported_algorithm_key_raise_error(self):
284
+ error_message = 'Unsupported algorithm key'
285
+ with self.assertRaisesWithPredicateMatch(
286
+ ValueError, lambda err: error_message in str(err)
287
+ ):
288
+ self._recipe_manager.add_quantization_config(
289
+ regex='.*/Dense/.*',
290
+ operation_name=_TFLOpName.FULLY_CONNECTED,
291
+ algorithm_key='decomposed_hadamard',
292
+ op_config=qtyping.OpQuantizationConfig(
293
+ weight_tensor_config=_TensorQuantConfig(num_bits=8),
294
+ ),
295
+ )
296
+ with self.assertRaisesWithPredicateMatch(
297
+ ValueError, lambda err: error_message in str(err)
298
+ ):
299
+ self._recipe_manager.add_quantization_config(
300
+ regex='.*/Dense/.*',
301
+ operation_name=_TFLOpName.ALL_SUPPORTED,
302
+ algorithm_key='decomposed_hadamard',
303
+ op_config=qtyping.OpQuantizationConfig(
304
+ weight_tensor_config=_TensorQuantConfig(num_bits=8),
305
+ ),
306
+ )
307
+
296
308
  def test_add_dynamic_config(self):
297
309
  self._recipe_manager.add_dynamic_config(
298
310
  regex='.*/Dense/.*',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-edge-quantizer-nightly
3
- Version: 0.5.0.dev20251215
3
+ Version: 0.5.0.dev20251216
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
@@ -16,8 +16,8 @@ ai_edge_quantizer/qtyping.py,sha256=y9KretGzUGztyLdmto2XV6U0cxrSrfLWP1UOVcwR4dY,
16
16
  ai_edge_quantizer/quantizer.py,sha256=_XRzj1UTXoPa0AeE1Ygz6XAelst2p2fGLqrhYB5MOCg,19150
17
17
  ai_edge_quantizer/quantizer_test.py,sha256=6gcOLsZO-XW9VoKmcf_9CalG-_2lSUAe_fcmH2zHcoU,30167
18
18
  ai_edge_quantizer/recipe.py,sha256=MEkfQ2Sg3KAE9LAORHWcbjYNPg06EUbwc1d-VspQA2U,6461
19
- ai_edge_quantizer/recipe_manager.py,sha256=6l2uq8KL23KLu9OQDmPGkxrFiwHrdDB9xnn-ni8WdEM,15036
20
- ai_edge_quantizer/recipe_manager_test.py,sha256=gYK3haUJ8-AISQvTI6tD-E-drJXQPSXPqBZdgpc5QTo,36595
19
+ ai_edge_quantizer/recipe_manager.py,sha256=OcnrY8Qj_kjDIXx71RX1MHw5qND89N-DKuMRajfGMEg,15205
20
+ ai_edge_quantizer/recipe_manager_test.py,sha256=pLEnLX8zwfZu9LcZoU0a8QpxNr8IFwbGdxp-hlYEwU4,37050
21
21
  ai_edge_quantizer/recipe_test.py,sha256=QisyaTol8JRZFcGOGyee7QRCvqj5VbF4guKWdIoMUOE,6213
22
22
  ai_edge_quantizer/transformation_instruction_generator.py,sha256=YmjtOFqc4ajGzvHEWTyIUIom0I0uJtxt4Uc9nxzmw2A,31852
23
23
  ai_edge_quantizer/transformation_instruction_generator_test.py,sha256=KW5-WoTTo9IqLEVnWxVC8ut8eWLi_91xfKgGqVQ9QDk,54635
@@ -74,8 +74,8 @@ ai_edge_quantizer/utils/tfl_interpreter_utils.py,sha256=zgXVSIoNU-M2V1Wcq06M0MPo
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.dev20251215.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
- ai_edge_quantizer_nightly-0.5.0.dev20251215.dist-info/METADATA,sha256=oDPUvwvP5bUUvUny3rIbTkZ7B367LDbvLuPJA3jP18Y,1707
79
- ai_edge_quantizer_nightly-0.5.0.dev20251215.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
- ai_edge_quantizer_nightly-0.5.0.dev20251215.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
- ai_edge_quantizer_nightly-0.5.0.dev20251215.dist-info/RECORD,,
77
+ ai_edge_quantizer_nightly-0.5.0.dev20251216.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
78
+ ai_edge_quantizer_nightly-0.5.0.dev20251216.dist-info/METADATA,sha256=n1FgmxZ5QAv5zN84QzZ6CQHX14nRmXaPJK2H46Bf7T0,1707
79
+ ai_edge_quantizer_nightly-0.5.0.dev20251216.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
80
+ ai_edge_quantizer_nightly-0.5.0.dev20251216.dist-info/top_level.txt,sha256=8QTfPnFXNVUhScFLaa-NWZMFWMn72M50DVPubpwWB1g,18
81
+ ai_edge_quantizer_nightly-0.5.0.dev20251216.dist-info/RECORD,,