@@ -493,23 +493,21 @@ class TOSAQuantizer(Quantizer):
493493 """Manage quantization annotations for TOSA-compatible backends.
494494
495495 .. warning::
496- The composable quantizer is now the default implementation. Setting
497- ``use_composable_quantizer=False`` is deprecated and will be removed in
498- two minor releases.
496+ Setting ``use_composable_quantizer=True`` enables an experimental API
497+ surface that may change without notice.
499498
500499 """
501500
502501 def __init__ (
503502 self ,
504503 compile_spec_or_tosa_spec ,
505- use_composable_quantizer : bool = True ,
504+ use_composable_quantizer : bool = False ,
506505 ) -> None :
507506 """Create a TOSA quantizer from a TOSA spec or Arm compile spec.
508507
509508 .. warning::
510- The composable quantizer is now the default implementation.
511- Setting ``use_composable_quantizer=False`` is deprecated and will
512- be removed in two minor releases.
509+ Setting ``use_composable_quantizer=True`` enables an experimental
510+ API surface that may change without notice.
513511
514512 """
515513 self .use_composable_quantizer = use_composable_quantizer
@@ -521,45 +519,10 @@ def __init__(
521519 self .quantizer = _TOSAQuantizerV2 (compile_spec_or_tosa_spec )
522520 else :
523521 logger .info (
524- "Using deprecated legacy quantizer implementation in the arm backend. Setting use_composable_quantizer=False will be removed in two minor releases. See https://github.com/pytorch/executorch/issues/17701"
522+ "Using default quantizer in the arm backend. This quantizer is planned to be replaced by the composable quantizer implementation in the future, see https://github.com/pytorch/executorch/issues/17701"
525523 )
526524 self .quantizer = _TOSAQuantizerV1 (compile_spec_or_tosa_spec )
527525
528- @staticmethod
529- def _validate_optional_quantization_config (
530- config_name : str , value : object , value_description : str = "value"
531- ) -> None :
532- if value is not None and not isinstance (value , QuantizationConfig ):
533- raise TypeError (
534- f"{ config_name } { value_description } must be "
535- "QuantizationConfig or None, "
536- f"got { type (value ).__name__ } ."
537- )
538-
539- @staticmethod
540- def _validate_config_dict (
541- config_name : str ,
542- value : object ,
543- is_valid_key : Callable [[object ], bool ],
544- key_description : str ,
545- ) -> Dict [Any , Optional [QuantizationConfig ]]:
546- if not isinstance (value , dict ):
547- raise TypeError (
548- f"{ config_name } must be a dict, got { type (value ).__name__ } ."
549- )
550-
551- for key , quantization_config in value .items ():
552- if not is_valid_key (key ):
553- raise TypeError (
554- f"{ config_name } keys must be { key_description } , "
555- f"got { type (key ).__name__ } ."
556- )
557- TOSAQuantizer ._validate_optional_quantization_config (
558- config_name , quantization_config , "values"
559- )
560-
561- return value
562-
563526 @property
564527 def tosa_spec (self ):
565528 """Return the TOSA specification used by the active quantizer."""
@@ -577,11 +540,12 @@ def global_config(self):
577540
578541 @global_config .setter
579542 def global_config (self , value : Optional [QuantizationConfig ]) -> None :
580- self ._validate_optional_quantization_config ("global_config" , value )
581543 if isinstance (self .quantizer , _TOSAQuantizerV1 ):
582544 self .quantizer .global_config = value
583545 else :
584- self .quantizer .set_global (value )
546+ raise NotImplementedError (
547+ "Composable quantizer does not allow setting global_config directly. Please use set_global() instead."
548+ )
585549
586550 @property
587551 def io_config (self ):
@@ -595,12 +559,12 @@ def io_config(self):
595559
596560 @io_config .setter
597561 def io_config (self , value : Optional [QuantizationConfig ]) -> None :
598- self ._validate_optional_quantization_config ("io_config" , value )
599562 if isinstance (self .quantizer , _TOSAQuantizerV1 ):
600563 self .quantizer .io_config = value
601564 else :
602- self .quantizer .clear_io_config ()
603- self .quantizer .set_io (value )
565+ raise NotImplementedError (
566+ "Composable quantizer does not allow setting io_config directly. Please use set_io() instead."
567+ )
604568
605569 @property
606570 def module_type_config (self ):
@@ -616,18 +580,12 @@ def module_type_config(self):
616580 def module_type_config (
617581 self , value : Dict [Callable , Optional [QuantizationConfig ]]
618582 ) -> None :
619- module_type_config = self ._validate_config_dict (
620- "module_type_config" ,
621- value ,
622- callable ,
623- "callable" ,
624- )
625583 if isinstance (self .quantizer , _TOSAQuantizerV1 ):
626- self .quantizer .module_type_config = module_type_config
584+ self .quantizer .module_type_config = value
627585 else :
628- self . quantizer . clear_module_type_config ()
629- for module_type , quantization_config in module_type_config . items ():
630- self . quantizer . set_module_type ( module_type , quantization_config )
586+ raise NotImplementedError (
587+ "Composable quantizer does not allow setting module_type_config directly. Please use set_module_type() instead."
588+ )
631589
632590 @property
633591 def module_name_config (self ):
@@ -643,18 +601,12 @@ def module_name_config(self):
643601 def module_name_config (
644602 self , value : Dict [str , Optional [QuantizationConfig ]]
645603 ) -> None :
646- module_name_config = self ._validate_config_dict (
647- "module_name_config" ,
648- value ,
649- lambda key : isinstance (key , str ),
650- "str" ,
651- )
652604 if isinstance (self .quantizer , _TOSAQuantizerV1 ):
653- self .quantizer .module_name_config = module_name_config
605+ self .quantizer .module_name_config = value
654606 else :
655- self . quantizer . clear_module_name_config ()
656- for module_name , quantization_config in module_name_config . items ():
657- self . quantizer . set_module_name ( module_name , quantization_config )
607+ raise NotImplementedError (
608+ "Composable quantizer does not allow setting module_name_config directly. Please use set_module_name() instead."
609+ )
658610
659611 def set_global (
660612 self , quantization_config : Optional [QuantizationConfig ]
@@ -1179,30 +1131,6 @@ def quantizers(self, value: List[Quantizer]) -> None:
11791131 """Update quantizers without accessing self._quantizers directly."""
11801132 self ._quantizers = value
11811133
1182- def _remove_quantizers_by_node_finder_type (
1183- self , node_finder_types : type [NodeFinder ] | tuple [type [NodeFinder ], ...]
1184- ) -> None :
1185- self ._quantizers = [
1186- quantizer
1187- for quantizer in self ._quantizers
1188- if not (
1189- isinstance (quantizer , PatternQuantizer )
1190- and isinstance (quantizer .node_finder , node_finder_types )
1191- )
1192- ]
1193-
1194- def clear_module_type_config (self ) -> _TOSAQuantizerV2 :
1195- self ._remove_quantizers_by_node_finder_type (ModuleTypeNodeFinder )
1196- return self
1197-
1198- def clear_module_name_config (self ) -> _TOSAQuantizerV2 :
1199- self ._remove_quantizers_by_node_finder_type (ModuleNameNodeFinder )
1200- return self
1201-
1202- def clear_io_config (self ) -> _TOSAQuantizerV2 :
1203- self ._remove_quantizers_by_node_finder_type ((InputNodeFinder , OutputNodeFinder ))
1204- return self
1205-
12061134 def annotate (self , model ):
12071135 reporter = QuantizerReporter (self .quantizers , "FINAL QUANTIZATION REPORT" )
12081136 model = super ().annotate (model )
@@ -1356,25 +1284,20 @@ class EthosUQuantizer(TOSAQuantizer):
13561284 """Quantizer supported by the Arm Ethos-U backend.
13571285
13581286 .. warning::
1359- The composable quantizer is now the default implementation. Setting
1360- ``use_composable_quantizer=False`` is deprecated and will be removed in
1361- two minor releases.
1287+ Setting ``use_composable_quantizer=True`` enables an experimental API
1288+ surface that may change without notice.
13621289
13631290 Args:
13641291 compile_spec (EthosUCompileSpec): Backend compile specification for
13651292 Ethos-U targets.
1366- use_composable_quantizer (bool): Whether to use the composable
1367- quantizer implementation. Setting this to ``False`` is deprecated
1368- and will be removed in two minor releases. See
1369- [issue #17701](https://github.com/pytorch/executorch/issues/17701)
1370- for details.
1293+ use_composable_quantizer (bool): Whether to use the composable quantizer implementation. See https://github.com/pytorch/executorch/issues/17701" for details.
13711294
13721295 """
13731296
13741297 def __init__ (
13751298 self ,
13761299 compile_spec : EthosUCompileSpec ,
1377- use_composable_quantizer : bool = True ,
1300+ use_composable_quantizer : bool = False ,
13781301 ) -> None :
13791302 super ().__init__ (compile_spec , use_composable_quantizer )
13801303
@@ -1383,24 +1306,19 @@ class VgfQuantizer(TOSAQuantizer):
13831306 """Quantizer supported by the Arm Vgf backend.
13841307
13851308 .. warning::
1386- The composable quantizer is now the default implementation. Setting
1387- ``use_composable_quantizer=False`` is deprecated and will be removed in
1388- two minor releases.
1309+ Setting ``use_composable_quantizer=True`` enables an experimental API
1310+ surface that may change without notice.
13891311
13901312 Args:
13911313 compile_spec (VgfCompileSpec): Backend compile specification for Vgf
13921314 targets.
1393- use_composable_quantizer (bool): Whether to use the composable
1394- quantizer implementation. Setting this to ``False`` is deprecated
1395- and will be removed in two minor releases. See
1396- [issue #17701](https://github.com/pytorch/executorch/issues/17701)
1397- for details.
1315+ use_composable_quantizer (bool): Whether to use the composable quantizer implementation. See https://github.com/pytorch/executorch/issues/17701" for details.
13981316
13991317 """
14001318
14011319 def __init__ (
14021320 self ,
14031321 compile_spec : VgfCompileSpec ,
1404- use_composable_quantizer : bool = True ,
1322+ use_composable_quantizer : bool = False ,
14051323 ) -> None :
14061324 super ().__init__ (compile_spec , use_composable_quantizer )
0 commit comments