@@ -69,6 +69,7 @@ def create_recipe(
69
69
recipe_type , activation_dtype = torch .float32 , ** kwargs
70
70
)
71
71
elif recipe_type == CoreMLRecipeType .TORCHAO_INT4_WEIGHT_ONLY_PER_CHANNEL :
72
+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
72
73
return self ._build_torchao_quantized_recipe (
73
74
recipe_type ,
74
75
weight_dtype = torch .int4 ,
@@ -77,6 +78,7 @@ def create_recipe(
77
78
)
78
79
elif recipe_type == CoreMLRecipeType .TORCHAO_INT4_WEIGHT_ONLY_PER_GROUP :
79
80
group_size = kwargs .pop ("group_size" , 32 )
81
+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
80
82
return self ._build_torchao_quantized_recipe (
81
83
recipe_type ,
82
84
weight_dtype = torch .int4 ,
@@ -85,11 +87,14 @@ def create_recipe(
85
87
** kwargs ,
86
88
)
87
89
elif recipe_type == CoreMLRecipeType .TORCHAO_INT8_WEIGHT_ONLY_PER_CHANNEL :
90
+ self ._validate_and_set_deployment_target (kwargs , ct .target .iOS16 , "torchao" )
88
91
return self ._build_torchao_quantized_recipe (
89
92
recipe_type , weight_dtype = torch .int8 , is_per_channel = True , ** kwargs
90
93
)
91
94
elif recipe_type == CoreMLRecipeType .TORCHAO_INT8_WEIGHT_ONLY_PER_GROUP :
92
95
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" )
93
98
return self ._build_torchao_quantized_recipe (
94
99
recipe_type ,
95
100
weight_dtype = torch .int8 ,
@@ -312,8 +317,6 @@ def _build_torchao_quantized_recipe(
312
317
ao_quantization_configs = [config ],
313
318
)
314
319
315
- # override minimum_deployment_target to ios18 for torchao (GH issue #13122)
316
- self ._validate_and_set_deployment_target (kwargs , ct .target .iOS18 , "torchao" )
317
320
lowering_recipe = self ._get_coreml_lowering_recipe (** kwargs )
318
321
319
322
return ExportRecipe (
0 commit comments