File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
benchmarks/microbenchmarks Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 1616 clean_caches ,
1717 create_model_and_input ,
1818 model_inference_time_in_ms ,
19- quantization_string_to_quantization_config ,
19+ string_to_config ,
2020)
2121from torchao .quantization import quantize_
2222
@@ -39,10 +39,10 @@ def run(config: BenchmarkConfig) -> BenchmarkResult:
3939
4040 # Use quantize_ to apply each quantization function to the model
4141 m_copy = deepcopy (base_model ).eval ().to (config .device )
42- quantization_config = quantization_string_to_quantization_config (
42+ quantization_config = string_to_config (
4343 config .quantization , high_precision_dtype = config .high_precision_dtype
4444 )
45- if quantization_config :
45+ if quantization_config is not None :
4646 quantize_ (m_copy , quantization_config )
4747 if config .use_torch_compile :
4848 print ("Compiling model...." )
Original file line number Diff line number Diff line change @@ -125,9 +125,7 @@ def get_default_device() -> str:
125125 return "cpu"
126126
127127
128- def quantization_string_to_quantization_config (
129- quantization : str , ** kwargs
130- ) -> AOBaseConfig :
128+ def string_to_config (quantization : str , ** kwargs ) -> AOBaseConfig :
131129 """Get quantization config based on quantization string.
132130
133131 Args:
You can’t perform that action at this time.
0 commit comments