@@ -37,20 +37,19 @@ def load(output_dir="./saved_results", model=None):
37
37
qconfig_file_path = os .path .join (os .path .abspath (os .path .expanduser (output_dir )), "qconfig.json" )
38
38
with open (qconfig_file_path , "r" ) as f :
39
39
per_op_qconfig = json .load (f )
40
+ config_mapping = load_config_mapping (qconfig_file_path , ConfigRegistry .get_all_configs ()["torch" ])
41
+ # select load function
42
+ config_object = config_mapping [next (iter (config_mapping ))]
40
43
41
- if " " in per_op_qconfig .keys (): # ipex qconfig format: {' ': {'q_op_infos': {'0': {'op_type': ...
44
+ if isinstance (config_object , (RTNConfig , GPTQConfig , AWQConfig , TEQConfig , AutoRoundConfig )): # WOQ
45
+ from neural_compressor .torch .algorithms .weight_only .save_load import load
46
+
47
+ return load (output_dir )
48
+ elif " " in per_op_qconfig .keys (): # ipex qconfig format: {' ': {'q_op_infos': {'0': {'op_type': ...
42
49
from neural_compressor .torch .algorithms .static_quant import load
43
50
44
51
return load (output_dir )
45
52
else : # FP8
46
- config_mapping = load_config_mapping (qconfig_file_path , ConfigRegistry .get_all_configs ()["torch" ])
47
- # select load function
48
- config_object = config_mapping [next (iter (config_mapping ))]
49
- if isinstance (config_object , (RTNConfig , GPTQConfig , AWQConfig , TEQConfig , AutoRoundConfig )): # WOQ
50
- from neural_compressor .torch .algorithms .weight_only .save_load import load
51
-
52
- return load (output_dir )
53
-
54
53
model .qconfig = config_mapping
55
54
if isinstance (config_object , FP8Config ):
56
55
from neural_compressor .torch .algorithms .habana_fp8 import load
0 commit comments