@@ -69,6 +69,7 @@ def create_recipe(
6969 recipe_type , activation_dtype = torch .float32 , ** kwargs
7070 )
7171 elif recipe_type == CoreMLRecipeType .TORCHAO_INT4_WEIGHT_ONLY_PER_CHANNEL :
72+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
7273 return self ._build_torchao_quantized_recipe (
7374 recipe_type ,
7475 weight_dtype = torch .int4 ,
@@ -77,6 +78,7 @@ def create_recipe(
7778 )
7879 elif recipe_type == CoreMLRecipeType .TORCHAO_INT4_WEIGHT_ONLY_PER_GROUP :
7980 group_size = kwargs .pop ("group_size" , 32 )
81+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
8082 return self ._build_torchao_quantized_recipe (
8183 recipe_type ,
8284 weight_dtype = torch .int4 ,
@@ -85,11 +87,14 @@ def create_recipe(
8587 ** kwargs ,
8688 )
8789 elif recipe_type == CoreMLRecipeType .TORCHAO_INT8_WEIGHT_ONLY_PER_CHANNEL :
90+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS16 , "torchao" )
8891 return self ._build_torchao_quantized_recipe (
8992 recipe_type , weight_dtype = torch .int8 , is_per_channel = True , ** kwargs
9093 )
9194 elif recipe_type == CoreMLRecipeType .TORCHAO_INT8_WEIGHT_ONLY_PER_GROUP :
9295 group_size = kwargs .pop ("group_size" , 32 )
96+ # override minimum_deployment_target to ios18 for torchao (GH issue #13122)
97+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
9398 return self ._build_torchao_quantized_recipe (
9499 recipe_type ,
95100 weight_dtype = torch .int8 ,
@@ -312,8 +317,6 @@ def _build_torchao_quantized_recipe(
312317 ao_quantization_configs = [config ],
313318 )
314319
315- # override minimum_deployment_target to ios18 for torchao (GH issue #13122)
316- self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
317320 lowering_recipe = self ._get_coreml_lowering_recipe (** kwargs )
318321
319322 return ExportRecipe (
0 commit comments